Skip to content

Instantly share code, notes, and snippets.

//========================================================================
// TETRIS with M5STACK : 2018.01.20 Transplant by macsbug
// 2018.05.03 Modified by @shiakrunochi
// Controller : Buttons A = LEFT, B = RIGHT, C = START, ROTATE
// Display : Left = 100x240, Center = 120x240, Right = 100x240
// Block : 8ea, 12x12 pixel
// SD : tetris.jpg : BackGround Image : R.G.B 320x240 pixel
// Github : (Original) https://macsbug.wordpress.com/2018/01/20/tetris-with-m5stack/
//========================================================================
#include <M5Stack.h> // M5STACK
#include <Arduino.h>
#include <english.h>
#include <oled.h>
#include <resources.h>
//#include <SoftwareSerial.h>
#include <SPI.h>
#include <Wire.h>
#include "jpResources.h"
unsigned char animation_offsetY=0;
#include <oled.h>
#include <misakiUTF16.h>
#include <SoftwareSerial.h>
#include <SPI.h>
unsigned char animation_offsetY=0;
// ビットパターン表示
// d: 8ビットパターンデータ
//
void bitdisp(byte x, byte y, uint8_t d ) {
from m5stack import lcd
from time import sleep
def makeSmaponDataList(dataList):
return [
dataList[16],dataList[17],dataList[0],dataList[1],dataList[6],dataList[7],dataList[22],dataList[23],
dataList[24],dataList[25],dataList[8],dataList[9],dataList[14],dataList[15],dataList[30],dataList[31],
dataList[18],dataList[19],dataList[2],dataList[3],dataList[4],dataList[5],dataList[20],dataList[21],
dataList[26],dataList[27],dataList[10],dataList[11],dataList[12],dataList[13],dataList[28],dataList[29],
dataList[34],dataList[35],dataList[50],dataList[51],dataList[52],dataList[53],dataList[36],dataList[37],
from m5stack import lcd
import machine, time
#lcd.compileFont('x12y20pxScanLine.c')
hexString="0123456789ABCDEF"
wordString="HOWALIVE"
lcd.clear()
lcd.setCursor(0, 0)
from m5stack import lcd
import utime, time
import machine
lcd.compileFont('x12y20pxScanLine.c')
lcd.font('x12y20pxScanLine.fon')
#5番ピン(GPIO5)をトリガーピンに設定
trigger_pin = machine.Pin(5, machine.Pin.OUT)
trigger_pin.value(0)
from m5stack import lcd
import time
fontDataDict = {
"0":[0x0000,0x0E00,0x1100,0x2080,0x2080,0x2080,0x2080,0x2080,0x2080,0x1100,0x0E00,0x0000,0x0000],
"1":[0x0000,0x0400,0x0C00,0x1400,0x2400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0000,0x0000],
"2":[0x0000,0x0E00,0x1100,0x2080,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x3F80,0x0000,0x0000],
"3":[0x0000,0x3F80,0x0100,0x0200,0x0400,0x0E00,0x0100,0x0080,0x2080,0x1100,0x0E00,0x0000,0x0000],
"4":[0x0000,0x0600,0x0A00,0x0A00,0x1200,0x1200,0x2200,0x2200,0x7F80,0x0200,0x0200,0x0000,0x0000],
"5":[0x0000,0x3F80,0x2000,0x2000,0x2E00,0x3100,0x0080,0x0080,0x0080,0x2100,0x1E00,0x0000,0x0000],
@shikarunochi
shikarunochi / PhotocellReceiver.py
Created October 8, 2018 03:39
M5Stack Photocell Receiver
from m5stack import lcd
import utime
import machine
lcd.clear()
lcd.setCursor(0, 0)
lcd.setColor(lcd.WHITE)
pin = machine.ADC(machine.Pin(35, machine.Pin.IN))
pin.atten(machine.ADC.ATTN_11DB)
@shikarunochi
shikarunochi / PhotocellSender.py
Created October 8, 2018 04:03
M5Stack Photocell Sender
from m5stack import lcd
import time
lcd.clear()
lcd.setColor(lcd.WHITE)
count = 0
while True:
if count == 0:
lcd.clear(lcd.WHITE)
@shikarunochi
shikarunochi / SyncPhotocellReceiver
Created October 8, 2018 04:12
M5Stack Sync Photocell Reveiver
from m5stack import lcd
import time
import machine
lcd.clear()
lcd.setCursor(0, 0)
lcd.setColor(lcd.WHITE)
dataPin = machine.ADC(machine.Pin(36, machine.Pin.IN))
dataPin.atten(machine.ADC.ATTN_11DB)