Skip to content

Instantly share code, notes, and snippets.

View deviceplususer's full-sized avatar

deviceplususer

View GitHub Profile
...
struct Animal
{
float x;
float y;
int life;
bool isDead;
RGB color;
};
int grassMatrix[WIDTH][HEIGHT];//草の育成を保持する2次元配列
int rndX = random(WIDTH);
int rndY = random(HEIGHT);
grassMatrix[rndX][rndY] += random(GRASS_GROWTH_POTENTIAL + 1); //ランダムな場所の草が成長する
int ledMatrix[WIDTH][HEIGHT];//LEDの配置と番号を記録する2次元配列
ledMatrix[0][0] = 0;// 0番は、x=0, y=0
ledMatrix[1][0] = 9;// 9番は、x=1, y=0
ledMatrix[2][0] = 10;// 10番は、 x=2, y=0
ledMatrix[3][0] = 19;// 19番は、 x=3, y=0
ledMatrix[4][0] = 20;// 10番は、 x=4, y=0
...
Description=Smart Watch Auto Run Program
[Service]
ExecStart=/bin/bash /home/pi/Programs/watch/watchd.sh
WorkingDirectory=/home/pi/Programs/watch
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
#!/bin/bash --rcfile
source /etc/bash.bashrc
source ~/.bashrc
source ~/env/bin/activate
export GOOGLE_APPLICATION_CREDENTIALS=/home/pi/credentials.json
echo $GOOGLE_APPLICATION_CREDENTIALS
cd /home/pi/Programs/watch
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import RPi.GPIO as GPIO
import subprocess
BUTTON = 17
hold_time=1.5
exec_dir = “/home/pi/Programs/watch”
# ライブラリのインポート
import RPi.GPIO as GPIO
import subprocess
BUTTON = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON, GPIO.IN)
# メインプログラム中
# ライブラリのインポート
from grove.grove_temperature_humidity_sensor import DHT
# DHT11 type
dht11 = DHT("11", 12)
# メインプログラム中
def main():
display = GroveOledDisplay128x64()
const int MT_F = 5;
const int MT_R = 6;
void setup(){
pinMode( MT_F, OUTPUT );
pinMode( MT_R, OUTPUT );
}
void loop(){
int speed;
const int MT_F = 5;
const int MT_R = 6;
void setup(){
pinMode( MT_F, OUTPUT );
pinMode( MT_R, OUTPUT );
}
void loop(){
analogWrite( MT_F, 128 );