Skip to content

Commit 80c3b6f

Browse files
committed
led ws2812b
1 parent 4366c40 commit 80c3b6f

File tree

6 files changed

+12
-46
lines changed

6 files changed

+12
-46
lines changed

atmega328p.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
CMD_RESET = 0x00
1717
CMD_SET_DATA = 0x01
1818
CMD_GET_DATA = 0x02
19+
CMD_SET_MODE = 0x03
20+
CMD_SET_LED = 0x04
1921

2022
ADDR_AI_FIRST = 0x00
2123
ADDR_AI_LAST = 0x01
@@ -35,7 +37,7 @@ def get_instance(cls):
3537
return cls._instance
3638

3739
def __init__(self):
38-
#Initialze the SPI
40+
# Initialze the SPI
3941
self.spi = spidev.SpiDev()
4042
self.spi.open(0,0)
4143
self.spi.max_speed_hz = BAUDRATE_MAX
@@ -54,6 +56,10 @@ def analogRead(self, addr):
5456
resp = self.spi.xfer([START, CMD_GET_DATA, addr, 0, 0], BAUDRATE)
5557
return resp[3]
5658

59+
def setLed(self, begin_led, end_led, red, green, blue):
60+
resp = self.spi.xfer([START, CMD_SET_LED, begin_led, end_led, red,green, blue], BAUDRATE)
61+
return resp[3]
62+
5763
def get_input(self, addr):
5864
if addr >= ADDR_AI_FIRST and addr <= ADDR_AI_LAST:
5965
return self.analogRead(addr)

audioControls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_instance(cls):
3939
return cls._instance
4040

4141
def __init__(self):
42-
self.mixer = alsaaudio.Mixer('Headphone')
42+
self.mixer = alsaaudio.Mixer('PCM')
4343

4444
def getVolume(self):
4545
print(self.mixer.getvolume())

coderbot.cfg

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1 @@
1-
{
2-
"move_power_angle_3":"60",
3-
"cnn_default_model":"generic_fast_low",
4-
"prog_maxblocks":"-1",
5-
"camera_jpeg_quality":"5",
6-
"show_page_control":"true",
7-
"camera_framerate":"30",
8-
"prog_scrollbars":"true",
9-
"move_fw_speed":"100",
10-
"prog_level":"adv",
11-
"move_motor_trim":"1",
12-
"move_motor_mode":"dc",
13-
"cv_image_factor":"2",
14-
"move_power_angle_1":"45",
15-
"camera_path_object_size_min":"4000",
16-
"button_func":"none",
17-
"camera_color_object_size_min":"4000",
18-
"camera_jpeg_bitrate":"1000000",
19-
"move_fw_elapse":"1",
20-
"show_control_move_commands":"true",
21-
"camera_color_object_size_max":"160000",
22-
"show_page_prefs":"true",
23-
"camera_exposure_mode":"auto",
24-
"ctrl_tr_elapse":"-1",
25-
"show_page_program":"true",
26-
"move_tr_elapse":"0.5",
27-
"camera_path_object_size_max":"160000",
28-
"sound_shutter":"$shutter.mp3",
29-
"ctrl_fw_elapse":"-1",
30-
"sound_stop":"$shutdown.mp3",
31-
"ctrl_tr_speed":"80",
32-
"ctrl_fw_speed":"100",
33-
"move_tr_speed":"85",
34-
"move_power_angle_2":"60",
35-
"ctrl_hud_image":"",
36-
"load_at_start":"",
37-
"sound_start":"$startup.mp3",
38-
"encoder":"True",
39-
"audio_volume_level":"100"
40-
}
1+
{"move_power_angle_3": "60", "cnn_default_model": "generic_fast_low", "prog_maxblocks": "-1", "camera_jpeg_quality": "5", "show_page_control": "true", "camera_framerate": "30", "prog_scrollbars": "true", "move_fw_speed": "100", "prog_level": "adv", "move_motor_trim": "1", "move_motor_mode": "dc", "cv_image_factor": "2", "move_power_angle_1": "45", "camera_path_object_size_min": "4000", "button_func": "none", "camera_color_object_size_min": "4000", "camera_jpeg_bitrate": "1000000", "move_fw_elapse": "1", "show_control_move_commands": "true", "camera_color_object_size_max": "160000", "show_page_prefs": "true", "camera_exposure_mode": "auto", "ctrl_tr_elapse": "-1", "show_page_program": "true", "move_tr_elapse": "0.5", "camera_path_object_size_max": "160000", "sound_shutter": "$shutter.mp3", "ctrl_fw_elapse": "-1", "sound_stop": "$shutdown.mp3", "ctrl_tr_speed": "80", "ctrl_fw_speed": "100", "move_tr_speed": "85", "move_power_angle_2": "60", "ctrl_hud_image": "", "load_at_start": "", "sound_start": "$startup.mp3", "encoder": "True", "audio_volume_level": "100", "wifi_mode": "ap", "wifi_ssid": "coderbot", "wifi_psk": "coderbot", "packages_installed": ""}

data/activities.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"_default": {}}
1+
{"_default": {"1": {"exec": {"camera": true, "log": false}, "name": "aaa", "drawerEnabled": true, "showName": true, "buttons": [{"label": "Esegui", "icon": "play_arrow", "colorBtn": "green", "colorText": "white--text", "action": "runProgramLegacy", "notErasable": true}, {"label": "Salva", "icon": "save", "colorBtn": "blue", "colorText": "white--text", "action": "saveProgram"}], "description": "aaa", "fontSize": "Medio", "capsSwitch": true, "bodyFont": "Roboto", "codeFont": "robotomono"}}}

photos/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[]
1+
[]

requirements_stub.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ smbus2==0.3.0
4545
spidev==3.4
4646
cachetools==3.0.0
4747
sox==1.3.7
48-
pyalsaaudio==0.8.4
4948
pytesseract==0.3.4
5049
sox==1.3.7
51-
pyalsaaudio==0.8.4
50+
pyalsaaudio==0.9.0

0 commit comments

Comments
 (0)