Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/*
////////////////////////////////////
//////////Magnatron/////////////////
////////////////////////////////////
////magnatronelectronics@gmail.com//
////////////////////////////////////
////////////////////////////////////
*/
int val = 0; // variable to store the data from the serial port
int rlyPin1 = 13;
int rlyPin2 = 12;
int rlyPin3 = 11;
int rlyPin4 = 10;
void setup()
{
pinMode(rlyPin1,OUTPUT); //Declare relayPINs
pinMode(rlyPin2,OUTPUT); //Declare relayPINs
pinMode(rlyPin3,OUTPUT); //Declare relayPINs
pinMode(rlyPin4,OUTPUT); //Declare relayPINs
Serial.begin(9600);
Serial.print("Magnatron Technologies");
delay(1000);
Serial.print("Device Status : Initializing");
for (int i=0; i <= 4; i++)
{
Serial.print('.');
delay(10);
}
Serial.print("System check: OK");
delay(500);
}
void loop ()
{
while(Serial.available() > 0)
{
val = Serial.read();
switch ( val)
{
case 10 :
Serial.print("device 1 Status : OFF");
rlyPin1=LOW;
break;
case 11:
Serial.print("device 1 Status : ON");
rlyPin1=HIGH;
break;
case 20:
Serial.print("device 2 Status : ON");
rlyPin2=LOW;
break;
case 21:
Serial.print("device 2 Status : ON");
rlyPin2=HIGH;
break;
case 30:
Serial.print("device 3 Status : ON");
rlyPin3=LOW;
break;
case 31:
Serial.print("device 3 Status : ON");
rlyPin3=HIGH;
break;
case 40:
Serial.print("device 4 Status : ON");
rlyPin4=LOW;
break;
case 41:
Serial.print("device 4 Status : ON");
rlyPin4=HIGH;
break;
case 00:
{
Serial.print("device * Status : OFF");
rlyPin1=LOW;
rlyPin2=LOW;
rlyPin3=LOW;
rlyPin4=LOW;
}
case 44:
{
Serial.print("device * Status : ON");
rlyPin1=HIGH;
rlyPin2=HIGH;
rlyPin3=HIGH;
rlyPin4=HIGH;
}
default:
Serial.print("Error: Unrecognized character");
}
}
}
he.. he.. everyone is student for life...Students simply make a "clapper" circuit.
They say, "Turn on TV" and the TV turns on.
They say, "TV off" and the TV turns off.
Then the dog barks 3 times and their TV turns on and two things are dropped on the floor and the TV turns off.