analogRead(sensorPin):read the analog value of photoresistor via
analog ports.
Serial.begin(9600): Initialize the serial port, baud rate of serial
communication is 9600
Serial.println : Serial port prints and word wrap.
(7) Extension Practice
We ’ ve known how to read the value of photoresistor. Let ’ s
combine photoresistor with LED and view the status of LED.
PWM restrains the brightness, so LED is linked with PWM pins,
connect LED to pin 10, keep pin of photoresistor unchanged, then
design the code:
/*keyestudio Mini Tank Robot V2
lesson 3.2
photocell-analog output
http://www.keyestudio.com