Unknow User
Published

Arduino control lamp with app

Control your light using an app

BeginnerProtip30 minutes428
Arduino control lamp with app

Things used in this project

Story

Read more

Custom parts and enclosures

the visual studio app

the app sends data trough com3, connect ur arduino to com3 or change it.

Schematics

schematics

Code

Arduino IDE

Arduino
Connect the usb cable to digital pin 8.
Upload the code to the Arduino, test it out in the serial monitor.
1 = light on
2= light off
int light = 8;

void setup()
{
  pinMode(light, OUTPUT);
  Serial.begin(9600);
  while (!Serial);
}

void loop() {
  if (Serial.available())
  {
    int state = Serial.parseInt();
    if (state == 1)
    {
      digitalWrite(light, HIGH);
      Serial.println("ON");
    }
    if (state == 2)
    {
      digitalWrite(light, LOW);
      Serial.println("OFF");

    }
  }
}

Credits

Unknow User

Unknow User

1 project • 0 followers

Comments