Skip to content

Instantly share code, notes, and snippets.

View jenschr's full-sized avatar

Jens Chr Brynildsen jenschr

View GitHub Profile
jenschr / settime_Serial.ino
Created May 2, 2024 18:52
Better init code for OWHL
/* improved settimeSerial.ino
Use this to get your real time clock date and time values
synchronized closely.
Copyright Luke Miller 2015
To use this program, upload it to your board, then open the
serial monitor at 57600 baud. Make sure the serial monitor
is set to send a 'newline' when you hit return (see the
menu in the lower right of the Arduino serial monitor window)
Minimal example for LTR329ALS sensor for LectureFeather
#include "Adafruit_LTR329_LTR303.h"
#include <Adafruit_DotStar.h>
Adafruit_LTR329 ltr = Adafruit_LTR329();
// There is only one pixel on the board
#define NUMPIXELS 1
jenschr / VS1053B_Adafruit_playback.ino
Created May 4, 2023 11:11
Simple sketch to make the baldram/ESP_VS1053_Library work with the Adafruit VS1053 breakout
#include <SPI.h>
#include <Wire.h>
#include <VS1053.h>
#include "SampleMp3.h"
// These are the pins used for the breakout example
#define BREAKOUT_RESET 9 // VS1053 reset pin (output)
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
#define BREAKOUT_DCS 6 // VS1053 Data/command select pin (output)
#define CARDCS 4 // Card chip select pin
jenschr / main.cpp
Last active May 20, 2023 18:31
ESP32's can use use either a TCP-client or a HTTP Client to do POST requests. This snippet will let you do a POST request directly to an IP address.
#include <WiFi.h>
#include <HTTPClient.h>
// WiFi network name and password:
const char * networkName = "your-ssid";
const char * networkPswd = "your-password";
// Internet address to send POST data to
const char * hostDomain = "";
const int hostPort = 3001;
String getValue(String data, char separator, int index)
int found = 0;
int strIndex[] = { 0, -1 };
int maxIndex = data.length() - 1;
for (int i = 0; i <= maxIndex && found <= index; i++) {
if (data.charAt(i) == separator || i == maxIndex) {
strIndex[0] = strIndex[1] + 1;
jenschr / index.html
Created September 27, 2022 09:54
TEK303 Mqtt example HTML
<!doctype html>
<html lang="en" data-theme="dark"/>
<meta charset="utf-8">
<script src="" type="text/javascript"></script>
<script src="./secret.js" type="text/javascript"></script>
<script src="./mqtt.js" type="text/javascript"></script>
<title>MQTT Demo</title>
<link rel="stylesheet" href="">
jenschr / mqtt.js
Created September 27, 2022 09:53
TEK303 Mqtt client example
const myTopic = "users/jensa/led";
const myServer = "";
const client = new Paho.MQTT.Client(myServer,8883, "myClientId" + new Date().getTime());
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
console.log("Start connection!");
var connectOptions = {
int sensorPin = 0;
void setup()
void loop()
#include <Arduino.h>
#include <Wire.h>
#include <i2cdetect.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_DotStar.h>
#include "Adafruit_SHT31.h"
#include "Adafruit_LTR329_LTR303.h"
// There is only one pixel on the board
jenschr / dweetio.ino
Last active March 1, 2024 08:04
Basic code for setting a Dweet with a GET request on an ESP32
#include <WiFi.h>
* Basic code for setting a Dweet with a GET request on an ESP32
* Original by Liz Miller (
* Updated for ESP32 by
// WiFi parameters
const char* ssid = "your-ssid"; // Replace with your ssid