// B Rushan Perera
// 17.05.2023
// Raspberry Pi Pico UART, ADC and PWM Test code
// Version 1.00
//-------------------------------------------------------------
void setup() {
// put your setup code here, to run once:
Serial1.begin(9600);
Serial1.println("Hello, Raspberry Pi Pico Test!");
pinMode(2, OUTPUT);
pinMode(14, OUTPUT);
pinMode(A0, INPUT);
analogReadResolution(12);
analogWriteResolution(12); // pwm resolution 1-16
}
void loop() {
int value = analogRead(A0);
Serial1.print("ADC value = ");
Serial1.println(value);
analogWrite(14,value);
digitalWrite(2, HIGH);
delay(500); // this speeds up the simulation
digitalWrite(2, LOW);
delay(500); // this speeds up the simulatio
}