From 6e29983839900b0379782f386378e87b970e0072 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 23 Jul 2018 02:13:09 -0700 Subject: [PATCH] Move example sketch to appropriately named folder The Arduino IDE requires the sketch folder name to match the filename of the primary sketch file. This change causes the example sketch to be accessible via the Arduino IDE's File > Examples > LIBRARYNAME menu after the library is installed. --- examples/{ => touchsense}/touchsense.ino | 62 ++++++++++++------------ 1 file changed, 31 insertions(+), 31 deletions(-) rename examples/{ => touchsense}/touchsense.ino (95%) diff --git a/examples/touchsense.ino b/examples/touchsense/touchsense.ino similarity index 95% rename from examples/touchsense.ino rename to examples/touchsense/touchsense.ino index f763f0b..caa2138 100644 --- a/examples/touchsense.ino +++ b/examples/touchsense/touchsense.ino @@ -1,8 +1,8 @@ -/** - This example uses the TouchSensor library to sense touch on a metal pad connected to a digital pin. +/** + This example uses the TouchSensor library to sense touch on a metal pad connected to a digital pin. - For details see the documentation.txt file. -*/ + For details see the documentation.txt file. +*/ #include #include "../libraries/TouchSensor/TouchSensor.h" @@ -23,10 +23,10 @@ int kIndicator = 13; // digital pin for LED to indicate touch #ifdef debug - // pins are in this order: reset, dc (d/c), sdin (mosi - data in), sclk (sck - clock), sce (chip enable), led (backlight) + // pins are in this order: reset, dc (d/c), sdin (mosi - data in), sclk (sck - clock), sce (chip enable), led (backlight) nokiaLCD display(10,11,12,13,7,6); -#endif - +#endif + bool testTouch(TouchSensor& sensor) { @@ -50,43 +50,43 @@ bool testTouch(TouchSensor& sensor) return isTouched; } - - - + + + //TouchSensor& sensor = touchChargeInt; //TouchSensor& sensor = touchChargeExt; //TouchSensor& sensor = touchDischarge; - - -void setup() -{ + + +void setup() +{ #ifdef debug Serial.begin(9600); Serial << "Starting..." << endl; display.init(); - display.backlight(true); + display.backlight(true); display.home(); display << "Ready" << endl; -#endif +#endif //delay(500); sensor.setThreshold(100); sensor.setSampleSize(100); - sensor.establishBaseline(); - - pinMode(kIndicator, OUTPUT); // init indicator led -} - -void loop() -{ + sensor.establishBaseline(); + + pinMode(kIndicator, OUTPUT); // init indicator led +} + +void loop() +{ bool touched = testTouch(sensor); if (!touched) - touched = sensor.switchPressed(); - - digitalWrite(kIndicator, touched); - - delay(200); -} - - + touched = sensor.switchPressed(); + + digitalWrite(kIndicator, touched); + + delay(200); +} + +