-
-
Save cpjobling/222597cccb0a98347184409b7034ac6a to your computer and use it in GitHub Desktop.
Experiment 3: Simple application of analogRead
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
// the setup function runs once when you press reset or power the board | |
word ADCval = 0; | |
void setup() { | |
// initialize Ports B and C pins 0-5 as outputs. | |
DDRB = 0b00111111; | |
DDRC = 0b00111111; | |
PORTB = 0; // both ports start from zero | |
PORTC = 0; | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
PORTC = (analogRead(A6)) / 16; // and that’s the active bit of the programme! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment