Skip to main content

Analogue and Serial Monitor

You will learn how to write a program that collects user input values and responds in an analogue manner.

Find the Worksheet here: (PDF Document) Analogue and Serial Monitor

The Worksheet requires you to start with a basic template program. Click and drag to select the program below, then copy and paste it into the Arduino Software.

/* 
* Analog template program 
*
* Written by Stephen Pithouse on behalf of Warwick Volunteers 
*/ 

int LED = 9;
int pot = 1; void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
int value = analogRead(pot); //value between 0 - 1023
analogWrite(LED, value / 4); //value between 0 - 254
}