Skip to content

Instantly share code, notes, and snippets.

Avatar

Jens Chr Brynildsen jenschr

View GitHub Profile
@jenschr
jenschr / gist:7642341
Created Nov 25, 2013
Interrupt example - The AVR way
View gist:7642341
/**
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:7642386
Created Nov 25, 2013
Interrupt example - The Arduino way
View gist:7642386
/**
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:7674521
Created Nov 27, 2013
Simplified sleep Demo (Created since the others I found were too complex to really illustrate the point)
View gist:7674521
/* 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 / Fona example file modified for use with Teensy
Last active Jun 2, 2019
Adafruit Fona modifications for Teensy 3.1, updated for latest lib + simplified
View Fona example file modified for use with Teensy
/*
Replace the first lines in your FONATest example file with the lines below. It's basically just changing from SoftwareSerial to HardwareSerial + changed pins to match the Teensy.
*/
#include <SoftwareSerial.h>
#include <HardwareSerial.h>
#include "Adafruit_FONA.h"
#define FONA_RX 1
#define FONA_TX 0
#define FONA_RST 4
@jenschr
jenschr / DeleteAllFilesAndFolderOnSDCard.ino
Last active Apr 3, 2020
Delete all files on an SD card (Arduino/SPI)
View DeleteAllFilesAndFolderOnSDCard.ino
#include <SD.h>
const int SDChipSelect = 4; // SS pin on the SD card.
// Other pins connected to normal SPI
File root;
int DeletedCount = 0;
int FolderDeleteCount = 0;
int FailCount = 0;
String rootpath = "/";
@jenschr
jenschr / gist:bfdf154fd6c09b59fcec
Created Jun 14, 2015
New method to let Adafruit Fona check the status of a call
View gist:bfdf154fd6c09b59fcec
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 Sep 9, 2015
Checking the call status of the SIM800L module
View Adafruit_FONA.cpp
int8_t Adafruit_FONA::checkCallStatus(void) {
uint16_t level;
if (! sendParseReply(F("AT+CPAS"), F("+CPAS: "), &level) ) return 0;
return level;
}
@jenschr
jenschr / Blink-eight-leds.ino
Last active Jul 26, 2019
Basic HTML page for talking to Particle Photon
View Blink-eight-leds.ino
@jenschr
jenschr / mbot_ir.ino
Created Sep 2, 2016
Working Makeblock IR example for mBot
View mbot_ir.ino
#include <MeMCore.h>
MeIR ir;
void setup() {
Serial.begin(9600);
}
void loop() {
if (ir.decode())
{
@jenschr
jenschr / i2cLCDextraIO.ino
Last active Oct 4, 2016
Use the internal temp sensor in the ATMEGA328P
View i2cLCDextraIO.ino
// ---------------------------------------------------------------------------
// 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