Skip to content

Commit

Permalink
init : update all items
Browse files Browse the repository at this point in the history
  • Loading branch information
Tora0615 committed Feb 22, 2023
1 parent e627c39 commit 3e8a768
Show file tree
Hide file tree
Showing 31 changed files with 856 additions and 1 deletion.
Binary file added 01.Hardware/BOM_AllinOneVer_PCB1.xlsx
Binary file not shown.
Binary file added 01.Hardware/Gerber_PCB1.zip
Binary file not shown.
Binary file added 01.Hardware/PickAndPlace_PCB1.xlsx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/* attiny 不能用,不然是最完美的*/
/*
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
RH_ASK driver(2000,11,6);
const char *send_reset = "reset";
void setup() {
pinMode(5, INPUT); //3.3v -> D5
pinMode(LED_BUILTIN, OUTPUT);
if (!driver.init()){
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10000);
}
}
void loop() {
if ( digitalRead(5) == LOW ) {
driver.send((uint8_t *)send_reset, strlen(send_reset));
driver.waitPacketSent();
//Serial.println("sent_reset");
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(3000);
}
// while(1){
//
// }
}
*/

/*
// 無法發送
#include <VirtualWire.h>
uint8_t send_reset[5] = {'r','e','s','e','t'};
void setup() {
pinMode(5, INPUT); //3.3v -> D5
pinMode(LED_BUILTIN, OUTPUT);
//vw_set_ptt_inverted(true);
vw_set_tx_pin(5);
vw_setup(2000);
}
void loop() {
if ( digitalRead(5) == LOW ) {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000);
vw_send((uint8_t *)send_reset, strlen(send_reset));
vw_wait_tx();
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(3000);
}
}
*/


#include "ManchesterRF.h" //https://github.com/cano64/ManchesterRF
#define TX_PIN 6 //any pin can transmit

ManchesterRF rf(MAN_600);

uint8_t data = 1; // meaning is to reset
String got_from_serial;

void setup() {
//pinMode(LED_BUILTIN, OUTPUT);
rf.TXInit(TX_PIN);
Serial.begin(9600);
}

void loop() {
if (Serial.available()) {
got_from_serial = Serial.readStringUntil('\n'); // 讀取傳入的字串直到"\n"結尾
if(got_from_serial == "reset!"){
rf.transmitByte(data);
}
}

// if ( digitalRead(5) == LOW ) {
// digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
// delay(500);
// rf.transmitByte(data);
// digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
// delay(500);
// }
}
Binary file added 02.Software/PcControlArduino/Beautiful Now.mp3
Binary file not shown.
41 changes: 41 additions & 0 deletions 02.Software/PcControlArduino/python_control_arduino.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 11 01:00:01 2023
@author: Arthur
"""

import serial #need to install pyserial
import time
from playsound import playsound ## pip install playsound==1.2.2

mp3file = "Beautiful Now.mp3"
delayTime = 29.8

COM_PORT = 'COM3' # 請自行修改序列埠名稱
BAUD_RATES = 9600
ser = serial.Serial(COM_PORT, BAUD_RATES)
time.sleep(1) #open serial will let arduino reboot, need to wait it. every arduino's reboot time is different...



# try many times guarantee it can send seccessfully
a = time.time()
for i in range(50):
ser.write(b'reset!\n')
ser.close()
#print(time.time()-a)


print("默默倒數"+ str(delayTime) +"秒 開始")
time.sleep(delayTime)

print("開始撥放")
playsound(mp3file)


'''
while True:
ser.write(b'reset!\n')
time.sleep(10)
'''
8 changes: 8 additions & 0 deletions 02.Software/v1.3_simple_attiny_ver/.theia/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [

]
}
29 changes: 29 additions & 0 deletions 02.Software/v1.3_simple_attiny_ver/define_table.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//火焰樣式
#define FIRENORNAL 0
#define FIREPURPLE 1
#define FIRESKYBLUE 2

//彩虹樣式
#define RAINBOWSIMILAR 0
#define RAINBOWDISTRIBUTED 1

//速度
#define SLOW 0
#define MID 1
#define FAST 2
#define VERYFAST 3

//顏色
#define RED 0
#define SKYBLUE 1
#define PURPLE 2
#define GREEN 3
#define BLUE 4
#define YELLOW 5
#define BLACK 10
#define WHITE 11

//亮度
#define NIGHT 0
#define DAWN 1
#define NOON 2
70 changes: 70 additions & 0 deletions 02.Software/v1.3_simple_attiny_ver/music_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
int delay_time = 30;

// demo list
// uint8_t timeListSize = 100;
// const float timeList[100] PROGMEM = {1,2,3,4,5,6,7,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71};
// const byte styleList[100] PROGMEM = {0,1,2,3,4,5,10,11,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,70,71,72,73};

/* bug : len = 1 will not work*/


uint8_t timeListSize = 74;
const float timeList[74] PROGMEM = {
08.87, 23.87, 38.80, 39.30, 40.67, 41.17, 42.55, 43.05, 44.33, 44.83, 46.27, 46.77, 48.15, 48.65, 50.00, 50.50, 51.93, 52.43,
53.67, 57.50, 61.30, 61.80, 64.96, 65.46, 68.67, 69.17, 72.53, 73.03,
76.50, 78.37, 80.26, 82.17, 84.00, 86.00, 88.00,
90.57, 91.50, 92.43, 93.38, 95.09, 98.10, 105.56, 106.76, 107.96,
110.20, 114.06, 117.60, 121.26, 126.85, 127.10, 127.90, 128.82, 143.96, 146.00, 147.76, 158.44, 158.94, 188.93,
189.75, 197.10, 200.66, 204.06, 211.37, 216.97, 217.89, 233.93, 235.03, 236.85, 237.83, 238.57, 239.57, 241.15, 245.23,
259.06 };

const byte styleList[74] PROGMEM = {
// A
10,
50,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,
56,53,55,53,55,53,55,53,55,53,
1,3,4,0,5,3,2,
10,52,58,55,58,52,51,50,10,
70,70,10,70,10,70,10,71,10,10,72,10,73,10,
60,10,61,62,63,10,67,10,10,10,10,10,10,52,52

// B
// 10,
// 10,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,
// 56,53,55,53,55,53,55,53,55,53,
// 1,3,4,0,5,3,2,
// 10,52,58,55,58,52,51,50,10,
// 70,10,10,70,10,70,10,71,72,72,72,10,73,10,
// 60,10,61,62,63,10,67,10,52,52,52,10,58,10,58


// C
// 10,
// 10,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,
// 56,53,55,53,55,53,55,53,55,53,
// 1,3,4,0,5,3,2,
// 10,52,58,55,58,52,51,50,10,
// 10,70,10,70,10,70,10,71,72,72,72,10,73,10,
// 60,10,61,62,63,10,67,10,52,52,52,10,58,10,58


// D
// 10,
// 10,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,
// 56,53,55,53,55,53,55,53,55,53,
// 1,3,4,0,5,3,2,
// 10,52,58,55,58,52,51,50,10,
// 70,10,10,70,10,70,10,71,10,72,72,10,73,10,
// 60,10,61,62,63,10,67,10,10,52,10,10,58,10,55


// E
// 10,
// 10,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,52,50,
// 56,53,55,53,55,53,55,53,55,53,
// 1,3,4,0,5,3,2,
// 10,52,58,55,58,52,51,50,10,
// 10,70,10,70,10,70,10,71,10,72,72,10,73,10,
// 60,10,61,62,63,10,67,10,10,52,10,10,58,10,55

};
Loading

0 comments on commit 3e8a768

Please sign in to comment.