Skip to content

Instantly share code, notes, and snippets.

View jenschr's full-sized avatar

Jens Chr Brynildsen jenschr

View GitHub Profile
@jenschr
jenschr / gist:bfdf154fd6c09b59fcec
Created June 14, 2015 21:56
New method to let Adafruit Fona check the status of a call
int8_t Adafruit_FONA::checkCallStatus(void) {
uint16_t level;
if (! sendParseReply(F("AT+CPAS"), F("+CPAS: "), &level) ) return 0;
return level;
}
@jenschr
jenschr / Adafruit_FONA.cpp
Created September 9, 2015 10:31
Checking the call status of the SIM800L module
int8_t Adafruit_FONA::checkCallStatus(void) {
uint16_t level;
if (! sendParseReply(F("AT+CPAS"), F("+CPAS: "), &level) ) return 0;
return level;
}
@jenschr
jenschr / gist:7642386
Created November 25, 2013 14:52
Interrupt example - The Arduino way
/**
Interrupt example - The Arduino way
For use with Arduino UNO and other 328 Arduino's
- Connect a button to pin 2 (with 10k pulldown)
- Connect a LED to pin 9 (with 220/330 Ohm resistor)
Nov 2013, Jens Brynildsen http://flashgamer.com/arduino/
**/
byte ledPin = 9;
@jenschr
jenschr / gist:7642341
Created November 25, 2013 14:49
Interrupt example - The AVR way
/**
Interrupt example - The AVR way
For use with Arduino UNO and other 328 Arduino's
- Connect a button to pin 2 (with 10k pulldown)
- Connect a LED to pin 9 (with 220/330 Ohm resistor)
Nov 2013, Jens Brynildsen http://flashgamer.com/arduino/
**/
@jenschr
jenschr / gist:7674521
Created November 27, 2013 11:55
Simplified sleep Demo (Created since the others I found were too complex to really illustrate the point)
/* Simplified sleep Demo
* ---------------------
* Shows how to make the Arduino sleep and wake up again.
*
* Connect pin 2 and 12 to 5V via a pullup-resistor (10k)
* Connect pin 12 to ground to make the Arduino sleep
* Connect pin 2 to ground to make the Arduino wake up again
*
* Based on the code in http://www.gammon.com.au/forum/?id=11488
* by Nick Gammon. Example written by Jens Chr Brynildsen 2013
@jenschr
jenschr / mbot_ir.ino
Created September 2, 2016 15:17
Working Makeblock IR example for mBot
#include <MeMCore.h>
MeIR ir;
void setup() {
Serial.begin(9600);
}
void loop() {
if (ir.decode())
{
@jenschr
jenschr / i2cLCDextraIO.ino
Last active October 4, 2016 18:35
Use the internal temp sensor in the ATMEGA328P
// ---------------------------------------------------------------------------
// Created by Francisco Malpartida on 1/1/12.
// Copyright 2011 - Under creative commons license:
// Attribution-NonCommercial-ShareAlike CC BY-NC-SA
//
// This software is furnished "as is", without technical support, and with no
// warranty, express or implied, as to its usefulness for any purpose.
//
// Thread Safe: No
// Extendable: Yes
#include <SoftwareSerial.h>
// RX, TX on Arduino
SoftwareSerial mySerial(8, 9);
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}
#include <SoftwareSerial.h>
// RX,TX on Arduino
SoftwareSerial mySerial(8, 9);
void setup()
{
Serial.begin(38400);
mySerial.begin(38400);
}
@jenschr
jenschr / LoRaEnviroNode.ino
Created November 24, 2016 12:56
LoRa Feather M0 with extra serial (CO2 sensor on Serial2 + DHT11)
#include <Arduino.h> // required before wiring_private.h
#include "wiring_private.h" // pinPeripheral() function
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTTYPE DHT11
#define DHTPIN 5
int ppm = 0;