Using Button to ON & OFF Led With CloudX M633

<img src ="https://www.instructables.com/files/deriv/FLC/57B2..."/>

Did you know that you can use CloudX M633 to turn on an LED when you press a button?

In this project am going to show you how you can use button to ON and OFF Led. when you press the button the led will on, when you press it again the led will off.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Component

Get all this component if you want to start;

  • CloudX M633

https://www.instructables.com/files/deriv/FP5/TFFN...>

  • CloudX SoftCard
  • V3 Cable
  • Led
  • Button Switch
  • Jumper Wire
  • 10k resistor
  • Breadboard

You can get your component Here

Step 2: HARDWARE

Step 3: CODING

Copy this Code to your CloudX M633

#include <CloudX/M633.h>
#define BULB pin1
#define Button pin2
bit flag;
setup(){
           //setup here
         pinMode(1, OUTPUT);
         pinMode(2, INPUT);
         BULB = LOW;
loop(){
           //Program here
 
    if(Button == 0 && BULB == LOW){
    delayMs(250);
    BULB = HIGH;         // turn on digital pin 1
    }
    if(Button == 0 && BULB == HIGH ){
    delayMs(250);
    BULB = LOW;          // turn off digital pin 1
    }
} 
}

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions