Close

Some Progress

A project log for Stop!

I know another Arudino project that probably could have been done a little bit easier by someone a little bit smarter

Anthony.selbyAnthony.selby 10/28/2015 at 21:230 Comments

I got the button put together and programmed

Super simple code

#include <ELECHOUSE_CC1101.h>

ELECHOUSE_CC1101 cc1101;
byte TX_NOTPUSHED_buffer[61] = {0};
byte TX_PUSHED_buffer[61] = {0};
byte i;
int buttonState = 0;

void setup() {
  pinMode(3, INPUT);
  
  // put your setup code here, to run once:
  Serial.begin(9600);
  cc1101.Init();
  for (i = 0; i <61; i ++)
  {
    TX_NOTPUSHED_buffer[i] = 0;
    TX_PUSHED_buffer[i] = 1;
  }
}

void loop() {
   buttonState = digitalRead(3);

  if (buttonState == HIGH) {
    // NOT PUSHED
    Serial.println("Not Pushed");
     cc1101.SendData(TX_NOTPUSHED_buffer,61);
  } else {
    // PUSHED
    Serial.println("Pushed");
    cc1101.SendData(TX_PUSHED_buffer,61);
  }

}

It does seem to work ... and it seems (even though it may not look like it) pretty reliabile ... I knocked it around a little bit and it still working just fine :-D


Discussions