If someone could please provide me a little explanation on the workings of this circuit and how these components are used to integrate with the code.
I have this code and project I want to implement for school but to be honest I lack a bit of knowledge on it and would like to understand it first instead of just buying components, wiring and downloading the code.
I don’t know if this was the right place to post this but it is an Arduino based project so that was my thinking.
Any help appreciated thanks.
https://301o583r8shhildde3s0vcnh-wpengi … ressed.jpg
intledPin = 3;
void setup()
{
Serial.begin(9600);
Serial.println(“Serial connection started, waiting for instructions…n0 = Offn1 = 25%n2 =50%n3 = 75%n4 = 100%”);
}
void loop ()
{
if (Serial.available()) {
char ser = Serial.read(); //read serial as a character
switch (ser)
{
case ‘0’:
analogWrite(ledPin, 0);
break;
case ‘1’:
analogWrite(ledPin, 64);
break;
case ‘2’:
analogWrite(ledPin, 128);
break;
case ‘3’:
analogWrite(ledPin, 192);
break;
case ‘4’:
analogWrite(ledPin, 255);
break;
default:
Serial.println(“Invalid entry”);
}
}
}