![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Working Dating game for Natural History Museum. Using Arduino, Relays KL and Raspberry pi. however needs cleanup. Change names of Relays CapKeys get rid of capRST - not being needed anymore
Fork of CapKey_46_v2_sensors by
Diff: cdg_main.cpp
- Revision:
- 5:5d684bfc69d6
- Parent:
- 4:34ca86236686
--- a/cdg_main.cpp Thu Nov 13 03:24:24 2014 +0000 +++ b/cdg_main.cpp Wed Feb 25 21:33:35 2015 +0000 @@ -24,9 +24,10 @@ #define CHNLLCDPRINT "CH-%1d" #define RASPIOUTDBG "PIOUT = %d \n\r" -DigitalOut Relays[NUMREL] = {D10,D11,D12,D13,PTC13,PTC16}; // corresponds to touches 1,2,3,4 -DigitalIn capKeys[NUMREL] = {D2,D4,D6,D8,PTC6,PTC7}; -DigitalOut capRST[NUMREL] = {D3,D5,D7,D9,PTC10,PTC11}; +//Relay are the outputs to the KL and input to the rasb pi --> +DigitalOut Relays[NUMREL] = {D10,D11,D12,PTB18,PTC13,PTC16}; // corresponds to touches 1,2,3,4 // +DigitalIn capKeys[NUMREL] = {D2,D4,D6,D8,PTC6,PTC7}; //input +DigitalOut capRST[NUMREL] = {D3,D5,D7,D9,PTC10,PTC11}; //DigitalIn sendKey(PTC3); // on board buttons just use 1 for test DigitalOut REDLed(LED_RED); // red led DigitalOut GREENLed(PTD5); // green led @@ -84,7 +85,7 @@ for (i=0; i<NUMREL; i++){ Relays[i].write(RELAY_OFF); capRST[i].write(HIGH); - capKeys[i].mode(PullDown); // click out the pull-up resistor looks like it needs a pulldown + capKeys[i].mode(PullUp); // click out the pull-up resistor looks like it needs a pulldown } while (true) { @@ -95,7 +96,7 @@ // read the state of the pushbutton value: if(OKtoRead) { for (i=TESTCHANNEL; i<NUMREL; i++){ - if (capKeys[i] == HIGH) { + if (capKeys[i] == LOW) { channelSelect = i; channelDisplay = channelSelect +1; buttonVal = true; // Got a touch