Browse Source

Added reference and fixed default emoji bug

Toby Chui 10 months ago
parent
commit
6200aa9338

+ 12 - 2
firmware/cute_useless_robot/cute_useless_robot.ino

@@ -3,13 +3,14 @@
     Cute Useless Robot (´・ω・`)
 
     Developed by tobychui
-    Original design by Kairoshi
+    Idea come from Kairoshi
 
 */
 
 /* Libraries */
 #include <MD_MAX72xx.h>
 #include <SPI.h>
+#include <SD.h>
 #include <Servo.h> //Require ESP32Servo, not the Arduino build in Servo.h
 
 /* Pins Definations */
@@ -42,6 +43,8 @@ void setup() {
   pinMode(STP_DATA_PIN, OUTPUT);
   pinMode(STP_CLOCK_PIN, OUTPUT);
   pinMode(STP_LATCH_PIN, OUTPUT);
+  standbySteppers();
+  
   /* Servo IO */
   servoSwitchPusher.attach(SERVO_SWITCH);
   servoCoverPusher.attach(SERVO_COVER);
@@ -65,7 +68,13 @@ void loop() {
   backward(50);
   delay(3000);
   rotateAntiClockwise(100);
-  delay(3000);
+  delay(1000);
+  //blink
+  loadAndRender("/b.bin");
+  delay(500);
+  loadAndRender("/a.bin");
+  delay(2000);
+  //rotate backward
   rotateClockwise(100);
   delay(3000);
   //Servo test
@@ -76,4 +85,5 @@ void loop() {
   servoCoverPusher.write(0);
   servoSwitchPusher.write(0);
   delay(3000);
+  
 }

+ 7 - 0
firmware/cute_useless_robot/display.ino

@@ -28,6 +28,13 @@ unsigned char frame_buffer[] = {
   0x00, 0x00, 0x00, 0x00
 };
 
+//A combined function for read frame to framebuffer and render to display
+//Example usage: loadAndRender("/a.bin");
+void loadAndRender(String filepath){
+  readFrameToFrameBuffer(filepath);
+  renderFrame();
+}
+
 //Read a binary file from SD card to current framebuffer
 int readFrameToFrameBuffer(String filepath){
   File file = SD.open(filepath, FILE_READ);

+ 6 - 0
firmware/cute_useless_robot/stepper.ino

@@ -9,6 +9,12 @@ void writeStep(byte stepByte) {
   delayMicroseconds(840); //780 - 800 ms minimum, recommend 840 to 860ms
 }
 
+//Set all coils to off and enter standby mode
+//to save power and prevent overheating
+void standbySteppers(){
+  writeStep(0b00000000);
+}
+
 //Move the robot forward by 8 * rev micro steps 
 void forward(int rev) {
   for (int i = 0; i < rev; i++) {

BIN
reference/vlcsnap-2024-05-14-20h59m31s592.png


BIN
reference/vlcsnap-2024-05-14-21h00m06s995.png


BIN
reference/vlcsnap-2024-05-14-21h00m34s648.png


BIN
reference/vlcsnap-2024-05-14-21h01m07s823.png


BIN
reference/vlcsnap-2024-05-14-21h01m17s638.png


BIN
reference/vlcsnap-2024-05-14-21h01m55s087.png


BIN
reference/vlcsnap-2024-05-14-21h01m57s024.png


BIN
reference/vlcsnap-2024-05-14-21h01m58s533.png


BIN
reference/vlcsnap-2024-05-14-21h02m04s789.png


BIN
reference/vlcsnap-2024-05-14-21h02m06s467.png


BIN
reference/vlcsnap-2024-05-14-21h02m12s385.png


BIN
reference/vlcsnap-2024-05-14-21h02m14s887.png


BIN
reference/vlcsnap-2024-05-14-21h02m16s308.png


BIN
reference/vlcsnap-2024-05-14-21h02m58s942.png


BIN
reference/vlcsnap-2024-05-14-21h03m13s234.png


BIN
reference/vlcsnap-2024-05-14-21h03m31s410.png


BIN
sd_card/anime/a.bin


BIN
sd_card/anime/b.bin


BIN
sd_card/anime/c.bin


BIN
sd_card/anime/d.bin


+ 1 - 1
sd_card/web/animator.html

@@ -145,7 +145,7 @@
 		
 	</div>
     <script>
-		let defaultTemplate = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0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