Skip to content

Instantly share code, notes, and snippets.

@Mango-kid
Last active December 28, 2015 17:29
Show Gist options
  • Select an option

  • Save Mango-kid/7535828 to your computer and use it in GitHub Desktop.

Select an option

Save Mango-kid/7535828 to your computer and use it in GitHub Desktop.
Reads a sensor attached to A0 and sends it over the Bluetooth module. The sensor can then be read from a COM port on a PC
// checkout for more -> https://github.com/Roboteurs/Product-code/tree/master/BT/BT.3.0.1
#include "PAN1321.h"
const int analogInPin = A0;
int sensorValue = 0;
// the serial and bluetooth are all intialized in Init_Bluetooth
void setup() {
Init_Bluetooth();
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// send the results over bluetooth
Serial.print("sensor = " );
Serial.println(sensorValue);
// wait 100 ms until sending the next value - 10Hz
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment