Skip to content

Instantly share code, notes, and snippets.

@shaielc
shaielc / HardwareSerial.cpp
Last active December 20, 2021 13:50
interrupt extension for UART
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "HardwareSerial.h"
HardwareSerial Serial(0);
HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL) {}
void HardwareSerial::setInterrupt(void(*arg)() )
@stojg
stojg / sleep.ino
Last active April 4, 2023 14:23
Arduino sleep example
// This is an example how to put an arduino board into deep sleep to save on battery power and
// periodically wake up to run some logic. Ideal for sensor stations like plant moisture sensors.
#include "Arduino.h"
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
// Blink Before sleeping
#define LED_PIN (13)
@cesarferreira
cesarferreira / AsyncTaskActivity.java
Last active September 25, 2024 03:30
Advanced Android AsyncTask Callback example
package com.cesarferreira.asynctaskcallback;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
@probonopd
probonopd / sendandreceive.ino
Last active September 20, 2021 19:53
Send Pronto Hex via an IR LED connected to Arduino Pin D9. Make sure you do not send a blank (" ") as the last character. Applied fix for Leonardo from https://github.com/probonopd/arduino-infrared-pronto/pull/1 to sendandreceive.ino -- TODO: Fix sendRaw to specify length as "sizeof(signal)/sizeof(int)" as in http://forum.arduino.cc/index.php?PH…
#include <IRremote.h>
// http://www.pjrc.com/teensy/td_libs_IRremote.html
// If one keypress results in multiple codes being output, then
// change in IRremoteInt.h:
// #define _GAP 50000
int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;
#include <LiquidCrystal.h>
#include "LCDKeypad.h"
#define DAYS 0
#define HOURS 1
#define MINUTES 2
#define SECONDS 3
// The LCD screen
LCDKeypad lcd;