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
# 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. |
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
str = ''' | |
from m5stack import lcd | |
lcd.clear() | |
lcd.print('Hello World!') | |
''' | |
f = open('main.py', 'w') | |
f.write(str) | |
f.close() |
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
# 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. |
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
#coding: utf-8 | |
""" | |
COPYRIGHT | |
This code is licensed under the MIT license. | |
<https://opensource.org/licenses/MIT> | |
Copyright (c) 2018 Switch Science, inc. |
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 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): |
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
""" | |
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 |
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 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"); |
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
// 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") { |
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 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() { |