Skip to content

Instantly share code, notes, and snippets.

@tuttelikz
Last active March 13, 2018 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuttelikz/1574f56301a6b90c129c981116c8c241 to your computer and use it in GitHub Desktop.
Save tuttelikz/1574f56301a6b90c129c981116c8c241 to your computer and use it in GitHub Desktop.
Script to send sensor information with bluetooth to terminal
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10,11); // RX | TX
int sensorPin = A3;
int sensorValue = 0;
void setup()
{
Serial.begin(9600);
Serial.println("Begin");
BTserial.begin(9600);
}
void loop()
{
sensorValue = analogRead(sensorPin);
Serial.write(BTserial.read());
Serial.println(sensorValue);
BTserial.write(Serial.read());
BTserial.println(sensorValue);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment