I have a problem were I get the opposite effect then i want.
My LED is always on and then it turns off for the amount of time i have set.
The problem is that is should be the other way around. So off to on.
I't on an UNO.
I have put digitalWrite(Induction, LOW); under VOID LOOP at the top. so i dont get why it does not turn the LED off when you first run the script.
The plan is to use a high voltage capacitor insted of an led. so i can control a spark.
(LED is just to test the script)
My code:
I have an uno and i have the 5v to the + side og the LED and the 8 PIN to the negativ side of the LED.
String command;
#define Induction 8
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(Induction, OUTPUT);
digitalWrite(Induction, LOW);
Serial.println("type command (test)");
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(Induction, LOW);
if (Serial.available()){
command = Serial.readStringUntil('\n');
command.trim();
if (command.equals("q")) {
digitalWrite(Induction, HIGH);
}
delay (2000);
digitalWrite(Induction, LOW);
}
}
That works. question. The 8 Pin outputs 5v? and is there a way to make that ground? an or make a passageway from example ( Pin 9 to Pin 10) and control the passageway to only passthrough then some code says so?
And thanks for your help
Edit: I have two 220 ohm between the led + and -
When you set the pin HIGH, it is at 5V. When you set the pin LOW, it is at ground.
If you want to turn on a "passageway" that is usually done with a relay. An UNO pin controls the relay to either connect the relay output pins or keep them open.