Skip to content

Instantly share code, notes, and snippets.

Avatar

Switch Science Code SwitchScienceCode

View GitHub Profile
View m5stack-amg8833-main-refined.py
# MicroPython sample program for M5Stack with AMG8833
# M5Stack
# http://www.m5stack.com/
# Panasonic Grid-EYE AMG8833
# https://industrial.panasonic.com/jp/products/sensors/built-in-sensors/grid-eye
# Usage
# Save this code as main.py then restart.
# Button A : Start drawing grid matrix of thermal data.
@SwitchScienceCode
SwitchScienceCode / gist:6a8786b09ef6179ccc38c6a67a9ad290
Last active Feb 28, 2018
Sample code for creating main.py with MicroPython's Paste-Mode.
View gist:6a8786b09ef6179ccc38c6a67a9ad290
str = '''
from m5stack import lcd
lcd.clear()
lcd.print('Hello World!')
'''
f = open('main.py', 'w')
f.write(str)
f.close()
@SwitchScienceCode
SwitchScienceCode / m5stack-amg8833-main.py
Last active Nov 24, 2021
Sample MicroPython code for M5Stack with AMG8833
View m5stack-amg8833-main.py
# MicroPython sample program for M5Stack with AMG8833
"""
COPYRIGHT
This code is licensed under the MIT license.
<https://opensource.org/licenses/MIT>
Copyright (c) 2018 Switch Science, inc.
@SwitchScienceCode
SwitchScienceCode / list-hex-triplet-colors.py
Last active Mar 19, 2018
generate a list of hex triplet color code
View list-hex-triplet-colors.py
#coding: utf-8
"""
COPYRIGHT
This code is licensed under the MIT license.
<https://opensource.org/licenses/MIT>
Copyright (c) 2018 Switch Science, inc.
View main-pyboard-webserver-sample.py
import pyb
import network
import machine
import usocket
import utime
spi = pyb.SPI(1)
cs = machine.Pin(pyb.Pin.board.X5, machine.Pin.OUT)
def setMacAddress(address):
View main-pyboard-http-get-sample.py
"""
COPYRIGHT
This code is licensed under the MIT license.
<https://opensource.org/licenses/MIT>
Copyright (c) 2017 Switch Science, inc.
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
@SwitchScienceCode
SwitchScienceCode / motiontweet.agent.nut
Created Jun 2, 2017
Electric Imp Explorer Kit Sample Code: Motion Detection by Tweet
View motiontweet.agent.nut
// Import libraries
#require "Twitter.class.nut:1.2.1"
// Declare global variables
tweeter <- null;
// Define functions
function tweetback(data) {
// This function is called after a Tweet is successfully posted
server.log("Tweet tweeted");
@SwitchScienceCode
SwitchScienceCode / ledapi.agent.nut
Last active Jul 1, 2017
Electric Imp Explorer Kit Sample Code: Agents
View ledapi.agent.nut
// Log the URLs we need
server.log("Turn LED On: " + http.agenturl() + "?led=1");
server.log("Turn LED Off: " + http.agenturl() + "?led=0");
function requestHandler(request, response) {
try {
// Check if the user sent led as a query parameter
if ("led" in request.query) {
// If they did, and led = 1 or 0, set our variable to 1
if (request.query.led == "1" || request.query.led == "0") {
@SwitchScienceCode
SwitchScienceCode / helloworld.device.nut
Last active Jun 7, 2017
Electric Imp Explorer Kit Sample Code: Hello World
View helloworld.device.nut
// Import Electric Imp’s WS2812 library
#require "WS2812.class.nut:3.0.0"
// Set up global variables
spi <- null;
led <- null;
state <- false;
// Define the loop flash function
function flash() {