www.keyestudio.com
analogRead(sensorPin):
analog ports.
Serial.begin(9600):
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
read the analog value of photoresistor via
Initialize the serial port, baud rate of serial
89