int RBG1[] {11, 12, 13};
const int BUZZ = 3;
const int sensor = 4;
const int sit = 2;
int sensorRead = 0;
void setup() {
pinMode(RBG1[11, 12, 13], OUTPUT);
pinMode(BUZZ, OUTPUT);
pinMode(sensor, INPUT);
pinMode(sit, INPUT);
}
void loop() {
if (digitalRead(sensor) == HIGH) {
scroll();
Boom();
}else {
Scilence();
}
if (digitalRead(sit) == HIGH) {
bob();
}
else No();
}
int i = 0;
void scroll() {
for (int i = 0; i<= 2; i++); {
digitalWrite(RBG1[i], HIGH);
delay(500);
}
}
void Boom() {
for (int i = 0; i< 8; i++){
digitalWrite(BUZZ, HIGH);
delay(random(200));
digitalWrite(BUZZ, LOW);
delay(random(200));
}
}
void bob() {
if (sit, HIGH) {
delay(+60000);
scroll();
Boom();
}
}
void Scilence() {
digitalWrite(BUZZ, LOW);
digitalWrite(RBG1[0, 1, 2], LOW);
}
void No() {
digitalWrite(sit, LOW);
}
Did you mean to use the comma operator there?
You can't simply invent syntax.
Ditto in setup
if (digitalRead(sit) == HIGH) {
is this better?
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
is this better? Thank you for your help!
I would be happier with
digitalWrite(RGB1[0], LOW);
digitalWrite(RGB1[1], LOW);
digitalWrite(RGB1[2], LOW);
How is the button wired?
A little wiring would help.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.