Interfacing Pushbutton with CloudX CloudX

  • img
Project Details

If we want a device that works by user input then we need to know how to interface a push button switch with the cloudx.The pushbutton is a component that connects two points in a circuit when you press it. The example glows an LED when you press the button.

 

Input using External PULL-DOWN Resistor

In the first circuit, a pull-up resistor of 10Kohm is connected with the switch and when it is not pressed giving a very weak LOW signal at the output.
In the second circuit, when the switch is pressed the output will be high. This high or low signal goes to the cloudx pin.
Here we have used pin2 for input. CloudX will read the input signal if we have set that pin 8 to be input by this instruction pinMode(2, INPUT).

Input using External PULL-UP Resistor

In the first circuit, a pull-down resistor of 10Kohm is connected with the switch and when it is not pressed giving a very weak HIGH signal at output.

In second circuit, when switch is pressed the output will be LOW. This high or low signal goes to the cloudx pin.

The push button circuit connection will determine whether to check for in pull-up mode or pull-down mode when writing the program.

 

Hardware Required

  1. CloudX M633 and Softcard
  2. Led
  3. Resistor 330R ohm
  4. Push Button Switch
  5. Resistor 10K ohm
  6. breadboard

 

Push Button CloudX wiring

 

Schematics

 

Code

#include <CloudX\M633.h>

setup(){
           //setup here
  pinMode(1,OUTPUT); //configure pin1 as output for LED
  pinMode(2,INPUT);  //configure pin2 input for button

loop(){
           //Program here
    if(pin2 is LOW)  //check if push button is pressed
           {
               delay(100);     //wait for debounce
               pin1 = HIGH;    //turn ON led 
               delay(1000);    //wait 1 second
               pin1 = LOW;     //turn OFF led
           }
      }
}

 

Video

 

 

Share this with friends