Things used in this project

Hardware components:
12994 02
Raspberry Pi 1 Model B+
×1
12002 04
Breadboard (generic)
×1
09590 01
LED (generic)
×1
08377 02 l
Resistor 330 ohm
×2
Omron b3f 1000 image 75px
SparkFun Pushbutton switch 12mm
×1
Software apps and online services:
mikode

Schematics

Basic Pi circuit
Simple example of blinking an LED and pressing a button with Mikode
Pi button interface raspberry pi circuit diagram cgkr3c4ked

Code

BlinkAssembly x86
This program will blink an LED and read the input from a Pi gpio 26 and put an X on the screen if it's pressed.
; blinking an led and reading gpio 26
;
; special rom address
; screen rom 0xc000
;
; 0xe100 output register
; 0xe101 direction register
; 0xe102 input register
;
; pin mappings
; b0 - gpio 6
; b1 - gpio 13
; b2 - gpio 19
; b3 - gpio 26
; b4 - gpio 12
; b5 - gpio 16
; b6 - gpio 20
; b7 - gpio 21
;
; defs
.def temp = r9
        LoadImm         r10,0x08
        StoreDirect     0xe101,r10 ; toggle pin to set input
        LoadImm         r10,0x00
        StoreDirect     0xe101,r10 ; set direction input gpio26
        LoadImm         r10,0x04
        StoreDirect     0xe101,r10 ; set direction output gpio19
loop:   
        LoadImm         temp,0x04
        StoreDirect     0xe100,temp
        Call            delay
        LoadImm         temp,0x00
        StoreDirect     0xe100,temp
        Call            delay
        Jump            loop
delay:
        LoadImm         r0,0x40
dlp:
        Call            read
        Decrement       r0
        BranchNotEqu    dlp 
        Return
read:
        LoadDirect      temp,0xe102 ;read pin during delay loop
        AndImm          temp,0x08   ; test b3 (gpio 26)
        BranchEqu       putx
        LoadImm         temp,' '
        Jump            cont
putx:
        LoadImm         temp,'X'
cont:   StoreDirect     0xc540,temp ; should be middle of the screen
        Return

Credits

Sprofile qedu5qn6qn
Bob Burns
1 project • 4 followers
Started programming again after 25? years.
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog