From 34de61d854c579f325959ffde02a588bd6972b4a Mon Sep 17 00:00:00 2001 From: Adrian Freed Date: Thu, 29 Mar 2018 21:02:50 -0700 Subject: [PATCH] examples added --- .../FastTouchSerialReportLilypadUSB.ino | 27 ++++++++++++ .../FastTouchSerialToneLilypadUSB.ino | 44 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino create mode 100644 Examples/FastTouchSerialToneLilypadUSB/FastTouchSerialToneLilypadUSB.ino diff --git a/Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino b/Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino new file mode 100644 index 0000000..efbf67c --- /dev/null +++ b/Examples/FastTouchSerialReportLilypadUSB/FastTouchSerialReportLilypadUSB.ino @@ -0,0 +1,27 @@ +#include + +// Adrian Freed 2018 + +void setup() +{ + SerialUSB.begin(9600); +} + + + void loop() + { + SerialUSB.print(fastTouchRead(A2)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(A3)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(A4)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(A5)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(2)); SerialUSB.print(" "); + SerialUSB.print(fastTouchRead(3)); SerialUSB.print(" "); + + for(int i=9;i<=11;++i) + { + SerialUSB.print(fastTouchRead(i)); SerialUSB.print(" "); + } + SerialUSB.println(); + delay(100); +} + diff --git a/Examples/FastTouchSerialToneLilypadUSB/FastTouchSerialToneLilypadUSB.ino b/Examples/FastTouchSerialToneLilypadUSB/FastTouchSerialToneLilypadUSB.ino new file mode 100644 index 0000000..69160d1 --- /dev/null +++ b/Examples/FastTouchSerialToneLilypadUSB/FastTouchSerialToneLilypadUSB.ino @@ -0,0 +1,44 @@ +#include + +// monotone touch sequencer +// Adrian Freed 2018 + +void setup() +{ + SerialUSB.begin(9600); +} + + + void loop() + { + int r; + const int tonepin=10; + const int notelength=140, notetonote=160; + SerialUSB.print(r = fastTouchRead(A2)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 587, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A3)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 440, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(A4)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 880, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(A5)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 153, notelength/(r-1)); delay(notetonote); } + SerialUSB.print(r = fastTouchRead(2)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 185, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(3)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 196, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(9)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 349, notelength/(r-1)); delay(notetonote);} + SerialUSB.print(r = fastTouchRead(11)); SerialUSB.print(" "); + if(r>1) + { tone(tonepin, 370, notelength/(r-1)); delay(notetonote);} + + SerialUSB.println(); +} +