Skip to content

Commit

Permalink
rename prev to previous in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed Jan 7, 2021
1 parent 17f3164 commit f24d32d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions examples/CapacitiveController/CapacitiveController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HIDKeyboard Keyboard(HID);
unsigned pins[NUM_PINS] = {PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PB0,PB1};
unsigned keys[NUM_PINS] = {' ',KEY_UP_ARROW,KEY_LEFT_ARROW,KEY_DOWN_ARROW,KEY_RIGHT_ARROW,'w','a','s','d','f'}; // Makey-Makey also has 'g' and CLICK, but we don't have enough ADC channels
unsigned buttons[NUM_PINS] = { 1, 0, 0, 0, 0, 2, 3, 4, 5, 6 };
unsigned prev[NUM_PINS];
unsigned previous[NUM_PINS];

ADCTouchSensor* sensors[NUM_PINS];

Expand Down Expand Up @@ -54,7 +54,7 @@ void setup()
for (int i=0; i<NUM_PINS; i++) {
sensors[i] = new ADCTouchSensor(pins[i]);
sensors[i]->begin();
prev[i] = 0;
previous[i] = 0;
}

digitalWrite(LED_BUILTIN, 1);
Expand Down Expand Up @@ -85,9 +85,9 @@ void loop()
for (int i=0; i<NUM_PINS; i++) {
if (sensors[i]->read() > 35) {
pressed = 1;
if(!prev[i]) {
if(!previous[i]) {
processPress(i);
prev[i] = 1;
previous[i] = 1;
}
if (joystickMode && buttons[i] == 0) {
if (i==1)
Expand All @@ -101,9 +101,9 @@ void loop()
}
}
else {
if(prev[i]) {
if(previous[i]) {
processRelease(i);
prev[i] = 0;
previous[i] = 0;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions examples/CapacitivePiano/CapacitivePiano.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const int numPins = sizeof(pins)/sizeof(*pins);
const uint8_t NOTE_ON = 0b10010000;
const uint8_t NOTE_OFF = 0b10000000;
int ref[numPins];
uint8_t prev[numPins];
uint8_t previous[numPins];
ADCTouchSensor* sensors[numPins];

void setup()
Expand Down Expand Up @@ -72,7 +72,7 @@ void setup()
for (int i=0; i<numPins; i++) {
sensors[i] = new ADCTouchSensor(pins[i]);
sensors[i]->begin();
prev[i] = 0;
previous[i] = 0;
}

digitalWrite(LED_BUILTIN, 0^LED_OFF);
Expand Down Expand Up @@ -103,15 +103,15 @@ void loop()
for (int i=0; i<numPins; i++) {
if (sensors[i]->read() > 25) {
pressed = 1;
if(!prev[i]) {
if(!previous[i]) {
midiNote(NOTE_ON, notes[i], 127);
prev[i] = 1;
previous[i] = 1;
}
}
else {
if(prev[i]) {
if(previous[i]) {
midiNote(NOTE_OFF, notes[i], 127);
prev[i] = 0;
previous[i] = 0;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions examples/ShowButtons/ShowButtons.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define NUM_PINS 10
unsigned pins[NUM_PINS] = {PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PB0,PB1};
unsigned prev[NUM_PINS];
unsigned previous[NUM_PINS];

ADCTouchSensor* sensors[NUM_PINS];

Expand All @@ -20,7 +20,7 @@ void setup()
for (int i=0; i<NUM_PINS; i++) {
sensors[i] = new ADCTouchSensor(pins[i]);
sensors[i]->begin();
prev[i] = 0;
previous[i] = 0;
}

digitalWrite(LED_BUILTIN, 1);
Expand All @@ -34,15 +34,15 @@ void loop()
for (int i=0; i<NUM_PINS; i++) {
if (sensors[i]->read() > 35) {
pressed = 1;
if(!prev[i]) {
prev[i] = 1;
if(!previous[i]) {
previous[i] = 1;
Serial.println(String("Press: ")+i);
}
}
else {
if(prev[i]) {
if(previous[i]) {
Serial.println(String("Release: ")+i);
prev[i] = 0;
previous[i] = 0;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ADCTouchSensor
version=0.0.10
version=0.0.12
author=Alexander Pruss
maintainer=arpruss <[email protected]>
sentence=Create Touch Sensors with a single analog pin without external hardware
Expand Down

2 comments on commit f24d32d

@ken58w
Copy link

@ken58w ken58w commented on f24d32d Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am programing esp8266 websever i keep grtting this erorr loading libs from C:\Users\ken58\OneDrive\Documents\Arduino\libraries: loading library from C:\Users\ken58\OneDrive\Documents\Arduino\libraries\ADCTouch: loading library.properties: Error reading file: Error parsing data at line 0: Invalid line format, should be 'key=value' whet is wring

@arpruss
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this library actually work on the esp8266?

Please sign in to comment.