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
... | |
struct Animal | |
{ | |
float x; | |
float y; | |
int life; | |
bool isDead; | |
RGB color; | |
}; |
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
… | |
int grassMatrix[WIDTH][HEIGHT];//草の育成を保持する2次元配列 | |
… | |
int rndX = random(WIDTH); | |
int rndY = random(HEIGHT); | |
grassMatrix[rndX][rndY] += random(GRASS_GROWTH_POTENTIAL + 1); //ランダムな場所の草が成長する | |
… |
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
… | |
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 | |
... |
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
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 |
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
#!/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 |
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 RPi.GPIO as GPIO | |
import subprocess | |
BUTTON = 17 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(BUTTON, GPIO.IN) | |
… | |
# メインプログラム中 |
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
# ライブラリのインポート | |
from grove.grove_temperature_humidity_sensor import DHT | |
# DHT11 type | |
dht11 = DHT("11", 12) | |
… | |
# メインプログラム中 | |
def main(): | |
display = GroveOledDisplay128x64() |
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
const int MT_F = 5; | |
const int MT_R = 6; | |
void setup(){ | |
pinMode( MT_F, OUTPUT ); | |
pinMode( MT_R, OUTPUT ); | |
} | |
void loop(){ | |
int speed; |
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
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 ); |