Skip to content

Instantly share code, notes, and snippets.

View jenschr's full-sized avatar

Jens Chr Brynildsen jenschr

View GitHub Profile
// This Arduino example demonstrates bidirectional operation of a
// 28BYJ-48, using a ULN2003 interface board to drive the stepper.
// The 28BYJ-48 motor is a 4-phase, 8-beat motor, geared down by
// a factor of 68. One bipolar winding is on motor pins 1 & 3 and
// the other on motor pins 2 & 4. The step angle is 5.625/64 and the
// operating Frequency is 100pps. Current draw is 92mA.
////////////////////////////////////////////////
//declare variables for the motor pins
int motorPin1 = 8; // Arduino pin 8 -> IN1
/*
* IRremote: IRreceiveDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
@jenschr
jenschr / MY1680U.ino
Created March 22, 2021 18:20
Arduino code snippet for controlling a MY1680U-12P using the MY1680U-16S chip for MP3 playback
/*
* Arduino snippet for controlling a MY1680U-12P
* using the MY1680U-16S chip for MP3 playback
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9);
#define START_CODE 0x7E
#define END_CODE 0xEF
@jenschr
jenschr / DweetSIM7600_for_TTGO_ESP32.ino
Created November 4, 2020 11:13
Basic sketch for an TTGO LoRa ESP-32 to send a message to Dweet.io using GET. Written specifically for the SIM7600E-H, but may work well on other similar modules.
/*
* Basic sketch to send a message to Dweet.io using GET
* This sketch is written specifically for the SIM7600E-H
* This specific version is for TTGO LoRa with Oled. Note
* that you cannot use the OLED with Serial since the OLED
* Reset pin conflicts with RX2.
*
* Connect the R pin on the module to pin 16 on the ESP32
* Connect the T pin on the module to pin 17 on the ESP32
*
@jenschr
jenschr / DweetSIM7600_for_Photon.ino
Last active November 4, 2020 11:06
Basic Particle Photon sketch to send a message to Dweet.io using GET. Written specifically for the SIM7600E-H, but may work well on other similar modules.
/*
* Basic sketch to send a message to Dweet.io using GET
* This sketch is written specifically for the SIM7600E-H
* This specific version is for Particle Photon.
*
* Connect the R pin on the module to pin 19 on the Photon
* Connect the T pin on the module to pin 18 on the Photon
*
* Also enter your own deviceName below (replace "8675840")
* and you can then go and see the result at
@jenschr
jenschr / SerialForSIM7600.ino
Created October 11, 2020 20:21
Basic Arduino sketch to talk to the SIM7600E-H using your Serial monitor. Enter AT commands in the Serial Monitor input and see the response from the module.
/*
* Basic sketch to talk to the SIM7600E-H using your
* Serial monitor. Enter AT commands in the Serial Monitor
* input and see the response from the module.
*
* Connect the R pin on the module to pin 10 on the Arduino
* Connect the T pin on the module to pin 11 on the Arduino
*
* Written by https://github.com/jenschr
*/
@jenschr
jenschr / DweetSIM7600.ino
Last active October 11, 2020 20:15
Basic Arduino sketch to send a message to Dweet.io using GET. Written specifically for the SIM7600E-H, but may work well on other similar modules.
/*
* Basic sketch to send a message to Dweet.io using GET
* This sketch is written specifically for the SIM7600E-H
*
* Connect the R pin on the module to pin 10 on the Arduino
* Connect the T pin on the module to pin 11 on the Arduino
*
* Also enter your own deviceName below (replace "8675840")
* and you can then go and see the result at
* http://dweet.io/get/latest/dweet/for/8675840
@jenschr
jenschr / max7219_matrix.ino
Last active October 3, 2020 15:09
Simple test code for 8x8 led matrix module with Arduino. Requires that you install the LedControl library.
/* Dot matrix control Scrolling
* Tutorial: https://www.electronoobs.com/eng_arduino_tut56.php
*/
#include <LedControl.h> //LedControl library: https://www.electronoobs.com/ledcontrol.php
const unsigned char scrollText[] PROGMEM ={" Embedded Systems "};
const int numDevices = 1; // number of MAX7219s used in this case 2
const long scrollDelay = 60; // adjust scrolling speed
@jenschr
jenschr / 7600_example.h
Last active September 15, 2020 16:10
Simple example for getting started sending SMS (using a button to send the required CTRL+Z char)
// First, wait for the green LED to go solid green
// Then, set the pin code using
// AT+CPIN=2643
// When the green LED blinks, you can check the name of the operator
// AT+CSPN?
// The turn on sending plain text messages (ASCII chars only)
// AT+CMGF=1
@jenschr
jenschr / base.h
Last active September 14, 2020 11:34
To get Flatbuffers to work with Teensy, we need to remove the Arduino specific code for STL (Teensy supports STL directly) in base.h (look for EDIT below, in two places)
#ifndef FLATBUFFERS_BASE_H_
#define FLATBUFFERS_BASE_H_
// clang-format off
// If activate should be declared and included first.
#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \
defined(_MSC_VER) && defined(_DEBUG)
// The _CRTDBG_MAP_ALLOC inside <crtdbg.h> will replace
// calloc/free (etc) to its debug version using #define directives.