Skip to content

Instantly share code, notes, and snippets.

@LucyMatch
Last active August 29, 2015 14:05
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 LucyMatch/60c5db95a8051f92b1e2 to your computer and use it in GitHub Desktop.
Save LucyMatch/60c5db95a8051f92b1e2 to your computer and use it in GitHub Desktop.
Arduino/Bluefruit tester code for photoresistor
// This code tests your photoresistor and prints the value to the serial port to make sure your arduino is hooked up correctly
// to test with BlueFruit Ez-Link run code onto ardunio with it plugged into computer with USB port first & check you are getting input from your sensor with it plugged in
// Then unplug the arduino from the computer and change the input for the sketch by going to
// Tools > Serial Port > /dev/cu/adafruit....nameOfBlueTooth
// then open the serial monitor and you will be able to see the input from your sensor wirelessly!!!
int lightPin = 0; //define a pin for Photo resistor change this if your photosensor is in another analogue Pin
void setup()
{
Serial.begin(9600); //Begin serial communcation
}
void loop()
{
Serial.print(analogRead(lightPin)); // print the value from the photo sensor
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment