Skip to content

Instantly share code, notes, and snippets.

@TakuroFukamizu
TakuroFukamizu / main.py
Created December 14, 2023 13:23
MicroPython driver for 74HC595 Shift Register IC work with Raspberry Pi Pico
import utime
from sr74hc595 import SR74hc595
dataPIN=8 # 74HC595 > 14 SER
latchPIN=6 # 74HC595 > 12 RCLK
clockPIN=7 # 74HC595 > 11 SRCLK
sr = SR74hc595(dataPIN, clockPIN, latchPIN, sr_size)
sr_size = 8 # 8, 16, 24...
bit = [0,0,0,0,0,0,0,0]
'use strict';
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
exports.handler = async (event) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
@TakuroFukamizu
TakuroFukamizu / m5atom-a4988.ino
Last active August 18, 2020 12:02
a4988 sample board for m5atom
#include <M5Atom.h>
#define DIR_PIN 23
#define STP_PIN 19
#define ENL_PIN 22
#define VOL_PIN 25
#define DSW_PIN 21
#define VOL_MAX (4095.0)
@TakuroFukamizu
TakuroFukamizu / m5atom-inf-circle-indicator.ino
Created April 4, 2020 06:43
M5Atom infinity circle indicator
#include "M5Atom.h"
uint8_t counter = 0;
uint8_t line_circle[] = {2,3,9,14,19,23,22,21,15,10,5,1}; // 12
uint8_t line_seq_limit = 12;
uint8_t line_seq_row_limit = 12;
uint8_t line_seq[12][12] = {
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
@TakuroFukamizu
TakuroFukamizu / m5atom-circle-indicator.ino
Created April 4, 2020 05:21
M5Atom Circle Indicator 16*9
#include "M5Atom.h"
uint8_t counter = 0;
uint8_t line1[] = {2,3,4,9,14,19,24,23,22,21,20,15,10,5,0,1}; // 16
uint8_t line2[] = {7,8,13,18,17,16,11,6}; //8
// ----------------
void display_progress_circle() {
M5.dis.clear();
@TakuroFukamizu
TakuroFukamizu / m5atom-click-progress.ino
Created April 4, 2020 01:53
m5atom-simple-click-and-progress-demo
#include "M5Atom.h"
uint8_t counter = 0;
uint8_t color_index = 0;
const CRGB COLOR[4] = {
0xf00000,
0x00f000,
0x0000f0,
0x707070
@TakuroFukamizu
TakuroFukamizu / m5atom_sesame_controller.ino
Created April 3, 2020 00:07
Sesame smartlock controller application run on M5Atom Matrix.
#include "M5Atom.h"
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#define WIFI_SSID "YOUR WIFI SSID"
#define WIFI_PASS "YOUR WIFI PASS"
#define SESAME_TOKEN "YOUR API KEY"
#define SESAME_DEVICE_ID "YOUR SESAME ID"
#include <M5StickC.h>
#define DIR_PIN 26
#define STEP_PIN 0
/*
for M5Stick-C
*/
void setup() {
@TakuroFukamizu
TakuroFukamizu / RFID-MFRC522-with-M5Stack.ino
Created September 9, 2019 14:32
RFID-MFRC522 with M5Stack
#include <SPI.h>
#include <MFRC522.h>
#include <M5Stack.h>
constexpr uint8_t RST_PIN = 2;
constexpr uint8_t SS_PIN = 5;
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
MFRC522::MIFARE_Key key;
@TakuroFukamizu
TakuroFukamizu / OMRON-GLS-S1-with-M5Stack.ino
Last active September 9, 2019 14:32
OMRON GLS-S1 magnetic switch with M5Stack
#include <M5Stack.h>
#define PIN_SW 2
void setup() {
M5.begin();
M5.Lcd.fillScreen(BLACK);
pinMode(PIN_SW, INPUT_PULLUP);