Inputs
ThePwnStick
Posts: 6
Hi all.
I'm new to propeller, and I still can't figure out how to detect when a button switch is pressed.
Can someone please help?
Also, how do I clear the EEPROM?
Post Edited (ThePwnStick) : 12/19/2008 5:13:54 AM GMT
I'm new to propeller, and I still can't figure out how to detect when a button switch is pressed.
Can someone please help?
Also, how do I clear the EEPROM?
Post Edited (ThePwnStick) : 12/19/2008 5:13:54 AM GMT
Comments
For the first part:
Do you have a switch connected to the prop? What type of switch, and is the pin pulled up or down with a resistor to hold the pin in a certain state when the button is not pressed?
Do you have an LED, LCD, buzzer, or TV connected to give feedback on a button press?
You'd need to set the pin as input ( dira[noparse][[/noparse]pin] := 0) , and use one of various commands that check for a pin state change, IF is a basic method to do this:
For the second part:
Why do you want to clear the EEPROM? It is easy enough to write anything you want over any or all EEPROM memory locations with PageWrite in the Basic or Minimal I2C objects, but I suspect what you are asking is not really how to clear the EEPROM
Post Edited (TChapman) : 12/19/2008 6:11:08 AM GMT
Second: Well, is there any way to reset the EEPROM to the default program?
EDIT: Ok, thank you. This works perfectly.
"main" can really be anything.· It's just a program with one function that does nothing.· I keep a copy of it called null.spin that I use to blank out a prop board so I can work on the hardware.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."
- Bjarne Stroustrup
Post Edited (Ken Peterson) : 12/19/2008 2:36:03 PM GMT
there is no default program
whenever you write into the EEPROM the content before gets overwritten.
If you want to test that your propeller-chip is still OK first step is to just detect your propellerchip by pressing F7
Next step is to load one of the demoprograms from the propellerdirectory
best regards
Stefan