P8X32A Resistive Touch Buttons Problem
This is my first elctro-device I am playing with. I have no experience in STAMP obviously but i do in C. I went through the propeller tutorials with no problem until i got to the Simple Circuts tutorial. I am having trouble programming the Resistive Touch Pad. I can set the the I/O Pin to High and Low, but only in code.
How do I detect if the Touch Pad has been, well touched.
I took a look at this page that has an example of how to use the Touch Pads but I need one in C.
http://microcontrollershop.com/product_info.php?products_id=4872
I also skimmed through the simpletools.h info page from the SimpleIDE Reference Page.
How do I detect if the Touch Pad has been, well touched.
I took a look at this page that has an example of how to use the Touch Pads but I need one in C.
http://microcontrollershop.com/product_info.php?products_id=4872
I also skimmed through the simpletools.h info page from the SimpleIDE Reference Page.
Comments
/* robo lights.... */ #include "simpletools.h" // Include simple tools int testbuttons(); int i; volatile int temp = 0; int main() // Main function { //cog_run(&testbuttons, 40); while (1) { if(testbuttons()) // check the buttons, if P7 is pressed, blink the lights { for(i=16;i<=23;i++) { high(i); pause(50); } for(i=23;i>=16;i--) { low(i); pause(50); } pause(100); } temp = 0; } } int testbuttons() // test the 7 button on quickstart board { high(7); reverse(7); if(input(7)== 0) temp = 1; return temp; }
hope it helpsdan
~Documents\SimpleIDE\Propeller GCC Demos\QuickStart\Whack-a-mole\qswam.c
/* * Get all buttons at once * Run this function from HUB if compiled for LMM. */ int getButtons() { int n = 16; int result = -1; int reading = 0; int pins = 0xFF; OUTA |= pins; //output high to buttons while(n--) { DIRA |= pins; //output high to buttons DIRA ^= pins; //switch to input reading = pins; msleep(2); //wait for RC time pause(2) using simpletools.h reading &= INA; //return button states result &= reading; } result = ~result & 0xFF; return result; }
Still, "finger licking good" works best.
Great, didn't know I could use those.
I do need a reference manual on all these commands
Dan
it will work with a ordinary finger. i guess the time lets the voltage die off a little.
anyways, fun playing with .
dan