Skip to content

Instantly share code, notes, and snippets.

// TAMIYA マイコンロボット工作セット (クローラータイプ)
// M5AtomS3 でコントロールするサンプル
#include "M5AtomS3.h"
#include "Wire.h"
const uint8_t SonnerAddr = 0x2C ;
const int PWMCH_R = 0; // 右モーターのPWMチャンネル
const int PWMCH_L = 1; // 左モーターのPWMチャンネル
const int PIN_R = 5; // 右モーター
const int PIN_L = 6; // 左モーター
#include "M5AtomS3.h"
// M5Atomとmicro:bitエッジコネクタの対応
#define MB_PIN1 7
#define MB_PIN2 8
#define MB_PIN12 1
#define MB_PIN13 5
#define MB_PIN14 6
#define MB_PIN15 39
#define MB_PIN16 38
// 改造FOLO(M5Samp PICO)用 ベーススケッチ
// コレをベースに機能を付け足していく予定
int mode = 0 ;
const int BTN = 36 ;
// 目玉用LED
const int LED_R = 3 ;
const int LED_L = 1 ;
@YuruPuro
YuruPuro / LCD1602-4BitMode.ino
Created June 11, 2023 01:06
Sample to operate LCD1602/LCD2004 without using library
const int rs=2,rw=3,en=4 ;
int lcdPin[] = {10,11,12,13} ;
// make some custom characters:
byte heart[8] = { 0b00000, 0b01010, 0b11111, 0b11111, 0b11111, 0b01110, 0b00100, 0b00000};
byte checkFig[8]={ 0b00001, 0b00011, 0b00111, 0b01111, 0b11111, 0b00100, 0b00010, 0b00001};
void lcdCommand(uint8_t value , uint8_t mode=LOW) {
digitalWrite(rs, mode);
digitalWrite(rw, LOW);
// Sample sketch for operating the stepping motor 28BYJ-48 and motor driver UKN2003A using the Arduino standard library
#include <Stepper.h>
#define PIN_BLUE 4
#define PIN_PINK 5
#define PIN_YELLOW 6
#define PIN_ORANGE 7
#define MOTOR_STEPS (2048)
Stepper stepper(MOTOR_STEPS, PIN_BLUE, PIN_YELLOW, PIN_PINK, PIN_ORANGE);
void setup() {
@YuruPuro
YuruPuro / HT16K33-7SEG.ino
Last active May 20, 2023 11:49
Sample to operate 4-digit 7-segment LED with HT16K33
// Sample to operate 4-digit 7-segment LED with HT16K33
#include <Wire.h>
#define HT16K33_ADDR 0x70
#define SEG_0 0b00111111
#define SEG_1 0b00000110
#define SEG_2 0b01011011
#define SEG_3 0b01001111
#define SEG_4 0b01100110
@YuruPuro
YuruPuro / M5Stick-ClappingCommander.ino
Created October 21, 2022 13:19
ClappingCommander with M5StickC Plus
#include <M5StickCPlus.h>
#include <driver/i2s.h>
// --- I2S MIC address and command
#define PIN_CLK 0
#define PIN_DATA 34
#define SAMPLE_RATE 44100
#define DATA_POINTS 128
#define READ_LEN (2 * DATA_POINTS)
uint8_t BUFFER[READ_LEN] = {0};
/**
* 静電容量式レインセンサー for M5Stamp
* 雨が降ったらLINEに通知
*/
#include <WiFi.h>
#include <WiFiClientSecure.h>
#define DEBUG true // true:OLED SSD1307 表示
#if DEBUG
// 温湿度センサー AM2301B I2C アクセステスト
#include <Wire.h>
#define BAUDRATE 9600
#define AM2301BADDR 0x38
// ----- Senser Data
struct AM2301B_s {
int humidity ; // 湿度
float temperature; // 温度
} am2301b ;
@YuruPuro
YuruPuro / touch-SmollSet.ino
Last active May 21, 2022 14:17
TouchScreen TSC2046 Simple Code
// TOUCH PANEL TEST
#include <SPI.h>
#define TFT_CLK 13
#define TFT_MOSI 12
#define TFT_MISO 11
#define TFT_CS 7
#define CMD_RDX 0XD0
#define CMD_RDY 0X90