I am trying to build a annoying timer doesn't do anything

int RBG1[] {12, 11, 10};

const int BUZZ = 3;
const int sensor = 4;
const int sit = 2;

int sensorRead = 0;

void setup() {
  pinMode(RBG1[12, 11 ,10], OUTPUT);
  pinMode(BUZZ, OUTPUT);
  pinMode(sensor, INPUT);
  pinMode(sit, INPUT);
  pinMode(8, OUTPUT);
void loop() {
int READ1 = digitalRead(sensor); delay(25); int READ2 = digitalRead(sensor);

int PUSH1 = digitalRead(sit); delay(25); int PUSH2 = digitalRead(sit);
  digitalWrite(8, HIGH);
  while ((READ1 == READ2) && (READ1 == HIGH)) {
  while ((READ1 == READ2) && (READ1 == LOW)) {
  while ((PUSH1 == PUSH2) && (PUSH1 == HIGH)) {
  while ((PUSH1 == PUSH2) && (PUSH1 == LOW)) {

int i = 0;

int scroll();
  for (int i = 0; i< 3; i++) {
    digitalWrite(RBG1[i], HIGH);
  for (int o = 0; 0< 3; o++) {
    digitalWrite(RBG[o], LOW);
int Boom() {
  for (int y = 0; y< 8; y++){
    digitalWrite(BUZZ, HIGH);//Sharon got this!
    digitalWrite(BUZZ, LOW);

int bob() {
  if (digitalRead(sit) == HIGH) {
    int e = 0;
    e +60000;
void Scilence() {
  digitalWrite(BUZZ, LOW);
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
tilt switch connects to pin 4
push button connects to pin 2
Buzzer connects to pin 3
pin 8 is just used to turn on an LED

Thanks for using code tags !

Can you attach a schematic, and possibly explain what’s supposed to happen.

If you reformat the code properly, you may see a few odd things that might help you solve your problem.

Not only does this not do anything (as the subject line suggests), but I doubt it will compile. 'or' is a boolean operation keyword. It is not a flow control keyword like 'if' or 'while'.

Here is a good article on how to use timers and interrupts.

Timers and Interrupts

  1. this doesn't compile
  2. I don't know what it is supposed to do much less what it does
  3. What kind of sensor is sensor?
  4. What is sit?
  5. How are sensor and sit wired?
  6. What do you think this does?
    e +60000;
  7. If you ever enter any of your while loops you will never get out

so, shooting for annoying, so, well done.

not sure if you understood the subject line, but to address your points, it would violate the last bit of the specification.

That won’t do what you hope it will.
Your while loops never exit because you never change or check the entry conditions inside the loops.

And what is that “or” doing. Again not what you think.

Zero is always less than three

We covered this in another topic.

Completely and utterly inappropriate for this purpose. :roll_eyes:

And indeed, for most such projects.

OP: Here are the two * references you need to study.

Are we being trolled?

sit is a pushbutton
sensor is a tilt switch

Four questions and two answers is not a good ratio.

what is an entry condition?

An entry condition is the bit in the brackets of the while instruction. If this evaluates to be true then the code in the braces following the while is executed. When this code is finished the entry conditions are evaluated again. The code in the braces must do something that could change those variables if the code is ever going to escape from this loop.

Your code does nothing in this direction so once entered any of your while loops they can never end and your code is stuck there forever.

thank you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.