- Joined
- Apr 9, 2011
- Posts
- 38,493
- Likes
- 1,166
Ordered. Everything should be set.
Nop. Have zero experience with arduino stuff. As for the cables and such, I think our school has that stuff? Since the lab is for DLD students, they should have jumper cables?
Should lol.
Well good luck.
You have done C++ before right? Arduino is basically C++ with some extra pre-defined functions, and pre other stuff that it sets.
http://playground.arduino.cc/Learning/PhotoResistor
Code:[color=rgb(79, 78, 78)] int lightPin = 0; //define a pin for Photo resistor int ledPin=11; //define a pin for LED void setup() { Serial.begin(9600); //Begin serial communcation pinMode( ledPin, OUTPUT ); } void loop() { Serial.println(analogRead(lightPin)); //Write the value of the photoresistor to the serial monitor. analogWrite(ledPin, analogRead(lightPin)/4); //send the value to the ledPin. Depending on value of resistor //you have to divide the value. for example, //with a 10k resistor divide the value by 2, for 100k resistor divide by 4. delay(10); //short delay for faster response to light. }[/color]
But essentially you just wire up the photo sensor on the bread board with resistors (if needed) and connect it to the correct analog input that you set in your code. You just have to initially do a base measuring of the laser on the sensor and do a cout << " TEST: " << variable << endl; or something or use the real time measuring in Arduino to see the variable and do a few runs of that.
Dude uses the serial connection to constantly monitor the data and uses a predefined Arduino syntax of pinMode( ledpin, output); giving it the value of 11 for the LED and defining it as an output.
You probably need to modify and or write your own code utilizing possibly only analogRead(lightPin) to see a base case unless you want to use serial print. Test it a few runs and then use an if loop or maybe a do while loop to get it to run at least once.