Last active
August 29, 2015 14:05
-
-
Save LucyMatch/60c5db95a8051f92b1e2 to your computer and use it in GitHub Desktop.
Arduino/Bluefruit tester code for photoresistor
This file contains 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
// 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