help me in coding
Hi everybody!!!! is anyone know how i can make code in BS2 microcontroller!!! i would like to use three Tact·sw all has differenlt LED color output!!!!! when i press sw 1 then sw 2 then sw 3 then the·4 LED will illuminate!!!!!!!!! and if i don't do it in the right order the 4 LED won't·illuminate!!!!
best wishes
thx
·
best wishes
thx
·
Comments
' INPUT_OUTPUT.BS2 ' This program demonstrates how the input/output direction of a pin is ' determined by the corresponding bit of DIRS. It also shows that the ' state of the pin itself (as reflected by the corresponding bit of PINS) ' is determined by the outside world when the pin is an input, and by the ' corresponding bit of PINS when it's an output. To set up the demo, ' connect a 10k resistor from +5V to P7 on the BASIC Stamp. The resistor ' to +5V puts a high (1) on the pin when it's an input. The BASIC Stamp ' can override this state by writing a low (0) to bit 7 of OUTS and ' changing the pin to output. ' {$STAMP BS2} ' {$PBASIC 2.5} Main: INPUT 7 ' Make P7 an input DEBUG "State of P7: ", BIN1 IN7, CR OUT7 = 0 ' Write 0 to output latch DEBUG "After 0 written to OUT7: ", BIN1 IN7, CR OUTPUT 7 ' Make P7 an output DEBUG "After P7 changed to output: ", BIN1 IN7 END
Then work with this
·
' HIGH_LOW.BS2 ' This simple program sets I/O pin 0 high for 1/2 second and low for ' 1/2 second in an endless loop. Connect an LED to P0 for a simple ' blinker. ' {$STAMP BS2} Main: HIGH 0 PAUSE 500 LOW 0 PAUSE 500 GOTO Main END
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
www.parallax.com/tabid/535/Default.aspx
www.parallax.com/tabid/440/Default.aspx
thx again
switch pin 4
switch1 pin 5
switch2 pin 6
switch3 pin 7
Main:
High 0 this will make ur pin 0·LED high which would be on pin 0
High 1 this will make ur pin·1·LED high which would be on pin 1
High 2 this will make ur pin·2·LED high which would be on pin 2
High 3 this will make ur pin·3·LED high which would be on pin 3
If switch=1 then
If switch1=1 then
If switch2= 1 then
If switch3= 1 then
low 0
low 1
low 2
low 3
pause 1000
endif
endif
endif
endif
END
·