Asked — Edited

Animated Face With WIO Terminal?

I have the Wio terminal:

https://www.hackster.io/SeeedStudio/display-robot-face-using-the-wio-terminal-68f87a

works great, but has no audio

This is the code I used for the Wio Terminal, how can it be used for a script in Synthiam with audio, emotions?

You are the programmer, my friend.

I can show a video of it on the Wio Terminal if you want to see it. Looks like the link above.

Here is the Arduino code:


#include
#include
Servo myservo;

//int outpin=D2;

int counter = 0;
int i = 0;
static LGFX lcd;
static LGFX_Sprite sprite(&lcd);

int pos = 0;

void drawEye(int x, int y) {
sprite.clear();
sprite.fillCircle(65,65,60,0xFFFF);
//sprite.drawEllipse(65,65,60,30,0xFFFF);
//sprite.drawFastHLine(5,62,120,0xFF);
sprite.fillCircle(x,y,15,0);
sprite.fillArc(65,65,60,1,180,360,0xED6E);
sprite.setPivot(65,65);
sprite.pushRotateZoom(80,70,0,1,0.5);
sprite.pushRotateZoom(240,70,0,1,0.5);
}

void sleepyEyes() {
int p_rect[4][4] = {{9,65,112,22},{22,65,86,41},{40,65,49,55},{63,65,4,59}};
sprite.clear();
sprite.fillCircle(65,65,60,0xFFFF);
sprite.fillCircle(65,70,10,0);
//sprite.fillArc(65,65,60,1,180,360,0xED6E);
sprite.setPivot(65,65);
for (int i=0;i<4;i++) {
sprite.fillArc(65,65,60,1,180,360,0xED6E);
sprite.fillArc(65,65,60,1,0,22*(i+1),0xED6E);
sprite.fillArc(65,65,60,1,180-(22*(i+1)),180,0xED6E);
sprite.fillRect(p_rect[i][0],p_rect[i][1],p_rect[i][2],p_rect[i][3],0xED6E);
sprite.pushRotateZoom(80,70,0,1,0.5);
sprite.pushRotateZoom(240,70,0,1,0.5);
delay(200);
}
delay(2000);
//sprite.pushRotateZoom(80,70,0,1,0.5);
//sprite.pushRotateZoom(240,70,0,1,0.5);
}


void setup() {
pinMode(WIO_5S_UP, INPUT_PULLUP);
pinMode(WIO_5S_DOWN, INPUT_PULLUP);

myservo.attach(0);

lcd.init();
lcd.setRotation(3);
lcd.setBrightness(128);
lcd.setColorDepth(16);
lcd.clear();

sprite.setColorDepth(16);
sprite.createSprite(130, 130);
drawEye(50,80);
lcd.drawArc(160,90,120,119,30,150,0xE800);

}

void loop() {
int x = random(15, 115);

for (pos = 0; pos <= 60; pos += 1) {
int l = pos + 20;
drawEye(l,80);
myservo.write(pos);
delay(80);
}

for (pos = 60; pos >= 0; pos -= 1) {
int l = pos;
drawEye(l,80);
myservo.write(pos);
delay(80);
}

delay(3000);

sleepyEyes();


}


Related Hardware EZ-B IoTiny
Related Control EZ-AI_Client_EZB

ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

PRO
Synthiam
#1   — Edited

You can have that Wio display accept UART commands from the USB cable and change expressions or something.

PS, your code is broken that you pasted because you did not wrap it in [ code ] or use the option. So it's missing characters. Specifically the #include lines at the top. You need to fix that

Anyway, you can have ARC send commands to the WIO using the Serial commands and have the WIO receive it. So on the WIO you'd modify the program to be something like.... (I can't test it so it probably won't work and needs you to do the rest).


#include
#include

//int outpin=D2;

int counter = 0;
int i = 0;
static LGFX lcd;
static LGFX_Sprite sprite(&lcd);

int pos = 0;

void drawEye(int x, int y) {
sprite.clear();
sprite.fillCircle(65,65,60,0xFFFF);
//sprite.drawEllipse(65,65,60,30,0xFFFF);
//sprite.drawFastHLine(5,62,120,0xFF);
sprite.fillCircle(x,y,15,0);
sprite.fillArc(65,65,60,1,180,360,0xED6E);
sprite.setPivot(65,65);
sprite.pushRotateZoom(80,70,0,1,0.5);
sprite.pushRotateZoom(240,70,0,1,0.5);
}

void sleepyEyes() {
int p_rect[4][4] = {{9,65,112,22},{22,65,86,41},{40,65,49,55},{63,65,4,59}};
sprite.clear();
sprite.fillCircle(65,65,60,0xFFFF);
sprite.fillCircle(65,70,10,0);
//sprite.fillArc(65,65,60,1,180,360,0xED6E);
sprite.setPivot(65,65);
for (int i=0;i<4;i++) {
sprite.fillArc(65,65,60,1,180,360,0xED6E);
sprite.fillArc(65,65,60,1,0,22*(i+1),0xED6E);
sprite.fillArc(65,65,60,1,180-(22*(i+1)),180,0xED6E);
sprite.fillRect(p_rect[i][0],p_rect[i][1],p_rect[i][2],p_rect[i][3],0xED6E);
sprite.pushRotateZoom(80,70,0,1,0.5);
sprite.pushRotateZoom(240,70,0,1,0.5);
delay(200);
}
delay(2000);
//sprite.pushRotateZoom(80,70,0,1,0.5);
//sprite.pushRotateZoom(240,70,0,1,0.5);
}


void setup() {
pinMode(WIO_5S_UP, INPUT_PULLUP);
pinMode(WIO_5S_DOWN, INPUT_PULLUP);

lcd.init();
lcd.setRotation(3);
lcd.setBrightness(128);
lcd.setColorDepth(16);
lcd.clear();

sprite.setColorDepth(16);
sprite.createSprite(130, 130);
drawEye(50,80);
lcd.drawArc(160,90,120,119,30,150,0xE800);

Serial.begin(115200);
}

void loop() {

  while (Serial.available() > 0) {

    // read the data from the USB (commands from ARC)
    int pos = Serial.read();

    // If the command is 0 then sleepy eyes, otherwise it's the eye position
    if (pos == 0)
      sleepyEyes();
    else 
      drawEye(pos,80);    
  }
}

Then in ARC you can init the COM port when you know what COMx the WIO is on. This javascript example...


// Only need to do this once
// So do it in your Init script
// Also, the COM port you'd have to know. I just put COM1 as an example
COM.open("com1", 115200);

Then, you can send commands to the COM port. Anything above 0 is an eye position. And 0 is sleepy eye position. Again, you need to know the COM port that the WIO is on that you initialized.


// Put the eyes in sleepy mode
COM.write("com1", 0);

sleep(2000);

// Move the eyes to position 80
COM.write("com1", 80);

sleep(2000);

// Move the eyes to position 40
COM.write("com1", 40);