Skip to content

Instantly share code, notes, and snippets.


Jens Chr Brynildsen jenschr

View GitHub Profile
jenschr / 7600_example.h
Last active Sep 15, 2020
Simple example for getting started sending SMS (using a button to send the required CTRL+Z char)
View 7600_example.h
// 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
// The turn on sending plain text messages (ASCII chars only)
// AT+CMGF=1
jenschr / base.h
Last active Sep 14, 2020
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)
View base.h
// clang-format off
// If activate should be declared and included first.
defined(_MSC_VER) && defined(_DEBUG)
// The _CRTDBG_MAP_ALLOC inside <crtdbg.h> will replace
// calloc/free (etc) to its debug version using #define directives.
jenschr / SerialPassthrough.ino
Last active Jul 24, 2020
Simple code snippet for talking to Serial devices - in this case a SIM7600E-H
View SerialPassthrough.ino
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9);
void setup()
mySerial.begin(115200); // use this line on a new module using 115200 baud by default
//mySerial.begin(19200); // after setting the baud rate to 19200, we use this speed for mySerial
pinMode(13, OUTPUT);
jenschr / AmphenolPressureSensorCodeExample.ino
Last active Jul 16, 2020
Simple code snippet for reading Amphenol Pressure sensors with I2C output such as the NPA-700 and NPA-730.
View AmphenolPressureSensorCodeExample.ino
* Simple code snippet for reading Amphenol
* Pressure sensors with I2C output such as
* the NPA Series of Surface-Mount Pressure
* Sensors NPA-700 and NPA-730.
* This basic snippet will likely work for
* similar sensors of other brands also.
* I used NPA-730B-05WD to test this. It's
* not an Arduino Library, but that's also
jenschr / combined.html
Last active Jun 10, 2021
Paho MQTT websocket example. I had a hard time finding working examples of using the 1.1.0 version of this lib. Here' a basic setup keeping track of connection and unsent messages.
View combined.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Konkurranse Nespresso</title>
<script src="" integrity="sha256-7LkWEzqTdpEfELxcZZlS6wAx5Ff13zZ83lYO2/ujj7g=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
View mqttToDatabase.js
var mqtt = require('mqtt'); //
var Topic = '#'; //subscribe to all topics
var Broker_URL = 'mqtt://localhost';
var Database_URL = 'localhost';
var options = {
clientId: 'MyMQTT'+Math.random()*64545353,
port: 1883,
username: 'MyUsername',
password: 'MyPassword',
jenschr / parseNumberToString.cpp
Last active Oct 30, 2019
Basic example of how a way parse a number to a char array using Modulo. Works for Arduino, stm32, Teensy and other Microcontrollers.
View parseNumberToString.cpp
signed long int myNum = -1701543;
void setup() {
char buff[14];
int bufferLength = parseNumberToString( buff, myNum );
View HC-05_example.cpp
/* HC-05 Serial pass through
The following AT-commands are supported:
AT-command Description
---------- ----------------------------------
AT+ROLE Output the current role (1=master/0=slave)
AT+UART Output UART com settings
AT+UART=115200,0,0 Setup comms to be 115200 baud
AT+ADDR? Check device address
AT+PSWD Check current connection password
View LoRaDuplexClient
LoRa Duplex communication
Sends a message every half second, and polls continually
for new incoming messages. Implements a one-byte addressing scheme,
with 0xFF as the broadcast address.
Uses readString() from Stream class to read payload. The Stream class'
timeout may affect other functuons, like the radio's callback. For an
jenschr / SimpleLoraSender.ino
Created Sep 10, 2019
Very simple LoRa client for TTGO 1.0 boards
View SimpleLoraSender.ino
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
#define SCK 5 // GPIO5 -- SX1278's SCK
#define MISO 19 // GPIO19 -- SX1278's MISO
#define MOSI 27 // GPIO27 -- SX1278's MOSI
#define SS 18 // GPIO18 -- SX1278's CS