Skip to content

Instantly share code, notes, and snippets.

Brett Walach technobly

View GitHub Profile
@technobly
technobly / main.c
Created Nov 17, 2019
Hadbadge 2019 Heartrate App
View main.c
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "mach_defines.h"
#include "sdk.h"
#include "gfx_load.h"
#include "cache.h"
@technobly
technobly / steam-machine-kill-switch1.cpp
Created Feb 24, 2019
Steam Machine Kill Switch (Simple Version)
View steam-machine-kill-switch1.cpp
/**
* Steam Machine Kill Switch (Simple Version)
* Brett Walach
* 2019-02-24
*
* A0 is wired directly to the gate of a 2N7002 mosfet
* The source of the 2N7002 is connected to GND
* The drain of the 2N7002 is connected to the Steam Machine's power switch
* Computer GND is connected the Xenon's GND
* Computer +5V from a USB port is connected to the Xenon's Li+
@technobly
technobly / hidapi.md
Last active Jul 16, 2020
OpenOCD "configure: error: hidapi is required for the CMSIS-DAP" HIDAPI_LIBS
View hidapi.md

If you are trying to install OpenOCD with CMSIS-DAP support on Mac OS and having trouble, this Gist may be for you :)

This is the typical error if you specifically try to configure OpenOCD for CMSIS-DAP support

checking for HIDAPI... no
checking for HIDAPI... no
checking for HIDAPI... no
checking for LIBFTDI... no
checking for LIBFTDI... no
@technobly
technobly / electron-ubidots.cpp
Created Jan 6, 2017
Electron Ubidots Example
View electron-ubidots.cpp
// Author: RWB <https://community.particle.io/users/rwb/activity>
SYSTEM_MODE(SEMI_AUTOMATIC);
//SYSTEM_THREAD(ENABLED);
// This #include statement was automatically added by the Particle IDE.
#include "Ubidots/Ubidots.h"
#define TOKEN "token" // Put here your Ubidots TOKEN
#define DATA_SOURCE_NAME "ElectronSleepNew"
//This serial prints system process via USB incase you need to debug any problems you may be having with the system.
@technobly
technobly / electron-low-power-sensor.cpp
Last active May 11, 2018
Electron Low Power Sensor Example (Read a sensor every hour, publish once per day, deep sleep in-between) Raw
View electron-low-power-sensor.cpp
/*
******************************************************************************
* Copyright (c) 2016 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
@technobly
technobly / rssi.cpp
Created Nov 15, 2016
Wi-Fi RSSI test app
View rssi.cpp
#define DEBUG_SERIAL true
#define MEASUREMENT_INTERVAL 10000
uint32_t lastTime = 0;
int i = 0;
void setup() {
if (DEBUG_SERIAL) Serial.begin(9600);
}
void loop() {
View blog-post-archive.md

Hi All, Yesterday I got a FTDI (UART to USB) board from unknown manufacturer. I plugged in to the iMac and without a surprise, it was not working. I have tried all the possible combinations, but no luck. Then after some digging in Apple documentation and Google about kext, FTDI and related, I finally made it. Here are the steps:

  1. In order to disable the AppleUSBFTDI.kext extension (From Mac OS X 10.8 there is Apple driver implementation for the FTDI chip).
cd /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns
sudo mv AppleUSBFTDI.kext AppleUSBFTDI.disabled
View photon-relay-shield-cycler.cpp
int onTime = 30000;
int offTime = 300000;
int cycles = 0;
bool isOn = true;
uint32_t startTime = millis();
int updateOnTime(String command){
onTime = command.toInt();
return onTime;
}
@technobly
technobly / wifi-listen-true.cpp
Created Jul 20, 2016
Manually enter and exit listening mode with the D0 pin
View wifi-listen-true.cpp
// Configure a wifi network with a bogus name or password into the Photon
// Ground D0 to call WiFi.listen(true) while the connection attempt is ongoing
// Open, then Ground D0 again to call WiFi.listen(false)
///
#include "application.h"
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(AUTOMATIC);
void reconnectAfterListen() {
@technobly
technobly / Pomodoro.cpp
Last active Jul 6, 2016
Super simple Pomodoro Timer via the Particle Internet Button!
View Pomodoro.cpp
// This #include statement was automatically added by the Particle IDE.
#include "InternetButton/InternetButton.h"
InternetButton b = InternetButton();
uint32_t workTime = 0;
uint32_t restTime = 0;
// Time definitions in milliseconds
You can’t perform that action at this time.