Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**************************************************************************
- Souliss - IR Receiver Hack
- It use Souliss Speak Easy to make write the sketch even easier.
- /*************************PINOUT*****************************
- 3 - IR HACK
- */
- /*********************************** HACKS ********************************************/
- /****************** IR REMOTE HACK ***********************/
- #include <IRremote.h>
- int RECV_PIN = 3; //This cannot be modified
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- /************ IR REMOTE BUTTON DEFINITION ***************/
- #define DEBUG_IR 0 //This values are long values returned by IRremote library, to get your values enable DEBUG and see results on Serial Port
- #define B0 16748655
- #define B1 16758855
- #define B2 16775175
- #define B3 16756815
- #define B4 16750695
- #define B5 16767015
- #define B6 16746615
- #define B7 16754775
- #define B8 16771095
- #define B9 16730295
- #define B10 16738455
- #define B11 16757325
- #define B12 16712445
- #define B13 16724685
- #define B14 16720095
- #define B15 16711935
- #define B16 16732335
- #define B17 16742535
- #define B18 16740495
- #define B19 16734375
- #define B20 16726215
- #define B21 16722135
- #define B22 16773135
- #define B23 16724175
- #define B_Repeat 4294967295
- /******************************** SOULISS CONFIGURATION *******************************************/
- #include "bconf/inSketch.h"
- #define QC_BOARDTYPE 0x05 //Arduino with ENC28J60 Ethernet Shield
- #define QC_GATEWAYTYPE 0x01 //None
- #define QC_INTERFACE 0x00 //None
- #include "Souliss.h"
- #include "Typicals.h"
- #include "SpeakEasy.h" // Is a library to code easy Souliss examples
- #include <SPI.h>
- /********************** NETWORK CONFIGURATION ******************************/
- // Define the network configuration
- // In the QuickCfg.h file set DEFAULT_BASEIPADDRESS[] = {192,168,1,0}
- #define eth_bridge_address 0x0011
- #define myvNet_subnet 0xFF00
- #define myvNet_supern 0x0000
- // defining myvNet_address as 0x0011 (is hexadecimal, in decimal is uqual to 17) gives
- // as IP address 192.168.1.17, use this address in SoulissApp
- /********************************** PIN DEFINITIONS *********************************/
- #define Led0_pin 9
- /********************************** SLOT DEFINITIONS *********************************/
- #define LED0 0
- /****************************************** SETUP ***********************************/
- void setup()
- {
- /************************ENABLE IR RECEIVER*******************/
- irrecv.enableIRIn(); // Start the receiver
- /************************ NETWORK SET ************************/
- // Setup the network configuration
- //
- // The vNet address is 11(hex) that is 17(dec), so the IP address is
- // the DEFAULT_BASEIPADDRESS[] defined in ethUsrCfg.h plus 17 on last
- // octect. If DEFAULT_BASEIPADDRESS[] = {192, 168, 1, 0} the IP address
- // for the board will be 192.168.1.17
- Souliss_SetAddress(eth_bridge_address, myvNet_subnet, myvNet_supern);
- SetAsGateway(eth_bridge_address);
- /*********************** LED STRIPS ***********************/
- Set_SimpleLight(LED0); //Led
- /********************** PIN SET **************************/
- pinMode(Led0_pin, OUTPUT);
- }
- /*********************************************** LOOP **********************************************/
- void loop()
- {
- // Here we start to play
- EXECUTEFAST() {
- UPDATEFAST();
- FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds
- read_IR(); // READ IR CODES, only one call every loop is needed.
- /******************************* LOGIC LED STRIPS ************************************/
- Souliss_IrIn(B4, Souliss_T1n_ToogleCmd, memory_map, LED0);
- Logic_SimpleLight(LED0);
- ssDigOut(Led0_pin, Souliss_T1n_Coil, LED0);
- }
- FAST_GatewayComms();
- }
- EXECUTESLOW() {
- UPDATESLOW();
- SLOW_10s() {
- /********************************TIMER LED STRIPS*****************************/
- Timer_SimpleLight(LED0);
- }
- }
- }
- /******************************************** HACK FUNCTIONS *******************************************/
- void read_IR() {
- if (irrecv.decode(&results)) {
- irrecv.resume(); // Receive the next value
- if (DEBUG_IR) Serial.println(results.value);//, HEX);
- }
- }
- uint8_t Souliss_IrIn(long remote_button, uint8_t value_state1, uint8_t *memory_map, uint8_t slot) {
- if (results.value == remote_button)
- {
- memory_map[MaCaco_IN_s + slot] = value_state1;
- results.value = 0;
- return MaCaco_DATACHANGED;
- }
- else return MaCaco_NODATACHANGED;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement