Pine

🌲 An indoor infrared receiver and transmitter with a temperature sensor 🎐

power AA
wireless Infrared
mcu SAMD21G18
bom items 49
bom cost USD $9.71
vendors 2
completed September 2020

IR emit

infrared IR emit aircon medium

Emit ON and OFF commands to the aircon


Code

Download code
#define DEBUG

#include <IRLibSendBase.h>
#include <IRLib_HashRaw.h>
#include "./data.h"

IRsendRaw mySender;

void setup() {
  #ifdef DEBUG
    SerialUSB.begin(9600);
    while (!SerialUSB) {}
    SerialUSB.println("Sending IR ON/OFF every 5 seconds");
  #endif
}

void loop() {
  delay(5000);
  mySender.send(rawDataON, RAW_DATA_LEN, 38);

  #ifdef DEBUG
    SerialUSB.println("Sent Turn ON Aircon");
  #endif

  delay(5000);
  mySender.send(rawDataOFF, RAW_DATA_LEN, 38);

  #ifdef DEBUG
    SerialUSB.println("Sent Turn OFF Aircon");
  #endif
}

Makefile

BOARD?=arduino:samd:arduino_zero_native
PORT := $(shell ls /dev/cu.usbmodem*)

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright,-whitespace/line_length *.ino

all:
	# This custom PCB does not have a crytal on pins PA00 and PA01
	# Hence, use -DCRYSTALLESS to replace the extra_flags in boards.txt
	arduino-cli compile --fqbn $(BOARD) --build-properties build.extra_flags="-DCRYSTALLESS -D__SAMD21G18A__ {build.usb_flags}" ./

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD)

server:
	echo "Open Chrome browser at http://localhost:8000"
	python -m SimpleHTTPServer 8000

clean:
	rm -r build

References