This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a variation of https://gist.github.com/Neradoc/86b3468a1612f8e1d57db20ab2fab5ae | |
// uses an empty enum as namespace for static functions | |
// otherwise it's pretty much the same | |
enum Log { | |
private static func __log<T>(type:String,_ input:T) { | |
//#if DEBUG | |
print(type,input) | |
//#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A logging function that uses emojis to make the output prettier | |
// - one clear way to specify the type of display we want | |
// - provide type safety for the printed parameter | |
// - no weird operator syntax ;-) | |
// Inspired by "Swift: Pretty in print()" by Andyy Hope | |
// part 1: https://medium.com/p/64832bb7fafa/ | |
// part 2: https://medium.com/p/640cea920653/ | |
// Note: Ideally you would give the object to print first, so the completion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_CircuitPlayground.h> | |
#include <Wire.h> | |
#include <SPI.h> | |
#define BLINKY 13 | |
// Threshold for a capacitive touch (higher = less sensitive). | |
#define CAP_THRESHOLD 100 | |
// Number of samples to take for a capacitive touch read. | |
#define CAP_SAMPLES 40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time,sys | |
from machine import Pin | |
from neopixel import NeoPixel | |
color = [0,64,64] | |
if len(sys.argv) >= 4: | |
try: | |
col = [int(sys.argv[1]),int(sys.argv[2]),int(sys.argv[3])] | |
color = col | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse, os, re, subprocess, glob, datetime, sys, shutil | |
import usb | |
import serial.tools.list_ports | |
tmpFiles= "/tmp/arduinotmp" | |
logFile = "/Users/spyro/Developement/ArduinoLib/ArduinoInstall.log" | |
arduinoCommand = ['arduino-cli',"compile"] | |
RED = '\033[91m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
NOTE: requires the usual secrets.py file | |
The test | |
- connects to the server | |
- sends headers to switch to websockets mode | |
- reads the headers that the server sends back | |
Note: the code doesn't do anything else with the connection, | |
it will hang or disconnect, but it should receive the headers first. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wifi | |
import ssl | |
import socketpool | |
import adafruit_requests | |
from secrets import secrets | |
print("WIFI: Connecting") | |
#wifi.radio.start_scanning_networks() | |
wifi.radio.connect(secrets['ssid'],secrets['password']) | |
#wifi.radio.stop_scanning_networks() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
print("I2C") | |
i2c = board.I2C() | |
while not i2c.try_lock(): | |
i2c.unlock() | |
#i2c.unlock() | |
try: | |
scan = i2c.scan() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
DISPLAY_ADDRESS1 = 0x72 | |
i2c = board.I2C() | |
# from sparkfun_serlcd import Sparkfun_SerLCD_I2C | |
# lcd = Sparkfun_SerLCD_I2C(i2c,DISPLAY_ADDRESS1) | |
import openlcd_mini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The MIT License (MIT) | |
# | |
# Copyright (c) 2017 Dan Halbert | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
OlderNewer