Digistump Forums
The Digispark => Digispark (Original) Support => Topic started by: lucadifabrizio on November 12, 2016, 11:40:46 am
-
I am trying to use a 433 cheapest module to switch two lamps on.
If I comment part of the code to switch-on only one lamp, the code works perfectly with the digispark.
If I use the whole code with a digispark the sent code is not correct.
If I try this code with an arduino one it works perfectly.
Any suggestion?
-
I am having the same issue with this. Here is my code. Works just fine using Arduino Unos.
#include <MANCHESTER.h> //include the comunication library
#include "Wire.h"
#define RxPin 1 //define the receiver pin
#define RXPWR 0 //Reciever VCC Pin
#define RXGND 2//Reciever Ground Pin
#define relay_Pin 5 //Turn the relay on and off
int buttonState = 0;
void setup()
{
Serial.begin(9600); // Debugging only
MANCHESTER.SetRxPin(RxPin); //user sets rx pin default 6
MANCHESTER.SetTimeOut(100); //user sets timeout default blocks
//setting the pins in arduino
pinMode(RXPWR, OUTPUT);
digitalWrite(RXPWR, HIGH);
pinMode(RXGND, OUTPUT);
digitalWrite(RXGND, LOW);
pinMode(relay_Pin, OUTPUT);
digitalWrite(relay_Pin, LOW);
}//end of setup
uint8_t i=0;
void loop(){
//sensorState = MANCHESTER.Receive();
unsigned int buttonState = MANCHESTER.Receive();
Serial.println(MANCHESTER.Receive());
if(buttonState != 03) //match this number with the sensor number
{
Serial.print(buttonState);
if (buttonState == 01) {
digitalWrite(relay_Pin, LOW);
Serial.print("Switched Low");
}
if (buttonState == 02) {
digitalWrite(relay_Pin, HIGH);
Serial.print("Switched High");
}
}
}//end of if