Last active
December 28, 2015 17:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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