Hook your sensor up to pin A1/D2 and ground. In the photo above we're testing an analog velostat step sensor as seen in the Firewalker Sneakers. You can also debug a digital sensor like the on/off antics of the vibration switches or tilt ball.
Load this code onto your GEMMA using a regular USB cable:
// GEMMA serial debugging #include <SoftwareSerial.h> #define SENSOR_PIN 1 // Analog input for sensor // Establish software serial on digital pins 0 and 1 SoftwareSerial mySerial = SoftwareSerial(0,1); int sensorValue; // Current filtered pressure reading void setup() { mySerial.begin(9600); // Set internal pullup resistor for sensor pin (analog 1 is digital 2) pinMode(2, INPUT_PULLUP); } void loop() { delay(500); sensorValue = analogRead(SENSOR_PIN); mySerial.println(sensorValue); }
Make sure you have the console cable driver installed, then it should show up like a regular serial port in the Arduino serial monitor.
Once you can see your sensor values, you can adjust your program to trigger events at different thresholds!