mirror of
https://github.com/playfultechnology/esp32-eyes.git
synced 2025-12-06 17:15:42 -08:00
Minor changes
This commit is contained in:
@@ -205,7 +205,7 @@ static const EyeConfig Preset_Skeptic_Alt = {
|
||||
.Inverse_Offset_Bottom = 0
|
||||
};
|
||||
|
||||
static const EyeConfig Preset_Fustrated = {
|
||||
static const EyeConfig Preset_Frustrated = {
|
||||
.OffsetX = 3,
|
||||
.OffsetY = -5,
|
||||
.Height = 12,
|
||||
|
||||
@@ -119,8 +119,8 @@ void FaceExpression::GoTo_Skeptic()
|
||||
void FaceExpression::GoTo_Frustrated()
|
||||
{
|
||||
ClearVariations();
|
||||
_face.RightEye.TransitionTo(Preset_Fustrated);
|
||||
_face.LeftEye.TransitionTo(Preset_Fustrated);
|
||||
_face.RightEye.TransitionTo(Preset_Frustrated);
|
||||
_face.LeftEye.TransitionTo(Preset_Frustrated);
|
||||
}
|
||||
|
||||
void FaceExpression::GoTo_Unimpressed()
|
||||
|
||||
380
doc/eyes.svg
Normal file
380
doc/eyes.svg
Normal file
@@ -0,0 +1,380 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
viewBox="0 0 210 297"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||
sodipodi:docname="eyes.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="true"
|
||||
inkscape:zoom="1.8088339"
|
||||
inkscape:cx="247.12054"
|
||||
inkscape:cy="273.38055"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1057"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1">
|
||||
<inkscape:grid
|
||||
id="grid2"
|
||||
units="px"
|
||||
originx="0"
|
||||
originy="0"
|
||||
spacingx="0.26458333"
|
||||
spacingy="0.26458334"
|
||||
empcolor="#0099e5"
|
||||
empopacity="0.30196078"
|
||||
color="#0099e5"
|
||||
opacity="0.14901961"
|
||||
empspacing="5"
|
||||
dotted="false"
|
||||
gridanglex="30"
|
||||
gridanglez="30"
|
||||
visible="true" />
|
||||
</sodipodi:namedview>
|
||||
<defs
|
||||
id="defs1">
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Triangle"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path135" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker7"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path7" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Triangle-6"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path135-1" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker7-5"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path7-6" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Triangle-6-4"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path135-1-3" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker7-5-9"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path7-6-9" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Triangle-6-4-1"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path135-1-3-4" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker7-5-9-3"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path7-6-9-4" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="Triangle-6-4-1-0"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path135-1-3-4-3" />
|
||||
</marker>
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="marker7-5-9-3-5"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
inkscape:stockid="Triangle arrow"
|
||||
markerWidth="0.5"
|
||||
markerHeight="0.5"
|
||||
viewBox="0 0 1 1"
|
||||
inkscape:isstock="true"
|
||||
inkscape:collect="always"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
markerUnits="userSpaceOnUse">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="M 5.77,0 -2.88,5 V -5 Z"
|
||||
id="path7-6-9-4-7" />
|
||||
</marker>
|
||||
</defs>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
id="rect1"
|
||||
style="fill:#5c5cd6;stroke:#5c5cd6;fill-opacity:1;stroke-opacity:1"
|
||||
d="m 52.777002,65.007195 32.770035,8.466667 c 4.810658,1.242911 8.968641,4.000014 8.968641,8.968641 v 16.557491 c 0,4.968626 -1.354181,6.322816 -6.322808,6.322816 H 50.131169 c -4.968627,0 -6.322808,-1.35419 -6.322808,-6.322816 V 73.975836 c 0,-4.968627 4.157983,-10.211552 8.968641,-8.968641 z"
|
||||
sodipodi:nodetypes="sssssssss" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.851072;stroke-dasharray:0.851072, 0.851072;stroke-dashoffset:0"
|
||||
d="M 100.54166,80.697919 H 38.364582"
|
||||
id="path2"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.912251;stroke-dasharray:1.8245, 0.912251;stroke-dashoffset:0"
|
||||
d="M 107.15625,72.760419 H 35.718747"
|
||||
id="path2-6"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.855516;stroke-dasharray:0.855516, 0.855516;stroke-dashoffset:0"
|
||||
d="M 99.880204,99.218753 H 37.703126"
|
||||
id="path3"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.962267;stroke-dasharray:0.962267, 0.962267;stroke-dashoffset:0"
|
||||
d="m 48.947915,111.125 0,-50.270831"
|
||||
id="path4"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.963503;stroke-dasharray:0.963503, 0.963503;stroke-dashoffset:0"
|
||||
d="M 88.635414,60.854171 V 111.125"
|
||||
id="path5"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#Triangle);marker-end:url(#marker7)"
|
||||
d="m 34.395832,83.343753 c 0,14.552084 0,14.552084 0,14.552084"
|
||||
id="path6" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:3.52778px;font-family:'Gill Sans MT';-inkscape-font-specification:'Gill Sans MT';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
x="22.274263"
|
||||
y="92.080513"
|
||||
id="text7"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan7"
|
||||
style="font-size:3.52778px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.5"
|
||||
x="22.274263"
|
||||
y="92.080513">Height</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#Triangle-6);marker-end:url(#marker7-5)"
|
||||
d="m 51.593751,113.77084 35.718746,0"
|
||||
id="path6-9"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#Triangle-6-4);marker-end:url(#marker7-5-9)"
|
||||
d="m 91.281247,113.77084 2.645834,0"
|
||||
id="path6-9-4"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:3.52778px;font-family:'Gill Sans MT';-inkscape-font-specification:'Gill Sans MT';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
x="64.306145"
|
||||
y="117.60609"
|
||||
id="text7-6"><tspan
|
||||
sodipodi:role="line"
|
||||
style="font-size:3.52778px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.5"
|
||||
x="64.306145"
|
||||
y="117.60609"
|
||||
id="tspan8">Width</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:3.52777px;font-family:'Gill Sans MT';-inkscape-font-specification:'Gill Sans MT';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
x="89.74733"
|
||||
y="118.82307"
|
||||
id="text9"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan9"
|
||||
style="stroke-width:0.5"
|
||||
x="89.74733"
|
||||
y="118.82307">Radius</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.5"
|
||||
x="89.74733"
|
||||
y="123.23278"
|
||||
id="tspan10">Bottom</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#Triangle-6-4-1);marker-end:url(#marker7-5-9-3)"
|
||||
d="m 99.218747,78.052086 0,-2.645834"
|
||||
id="path6-9-4-4"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:3.52777px;font-family:'Gill Sans MT';-inkscape-font-specification:'Gill Sans MT';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
x="102.53122"
|
||||
y="76.646492"
|
||||
id="text9-2"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan9-6"
|
||||
style="stroke-width:0.5"
|
||||
x="102.53122"
|
||||
y="76.646492">Radius</tspan><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.5"
|
||||
x="102.53122"
|
||||
y="81.056206"
|
||||
id="tspan10-3">Top</tspan></text>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#Triangle-6-4-1-0);marker-end:url(#marker7-5-9-3-5)"
|
||||
d="m 92.604164,70.114586 0,-5.291667"
|
||||
id="path6-9-4-4-8"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:3.52777px;font-family:'Gill Sans MT';-inkscape-font-specification:'Gill Sans MT';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
x="95.266388"
|
||||
y="69.306709"
|
||||
id="text9-2-7"><tspan
|
||||
sodipodi:role="line"
|
||||
style="stroke-width:0.5"
|
||||
x="95.266388"
|
||||
y="69.306709"
|
||||
id="tspan10-3-5">Slope x Height</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -11,8 +11,10 @@
|
||||
#include "Face.h"
|
||||
|
||||
// CONSTANTS
|
||||
const byte joystickPins[] = {26, 25};
|
||||
const byte joystickPins[] = {25, 26};
|
||||
const byte blinkPin = 16;
|
||||
const byte moodPins[] = {12, 13, 15};
|
||||
const eEmotions moods[] = {eEmotions::Angry, eEmotions::Sad, eEmotions::Surprised};
|
||||
|
||||
// GLOBALS
|
||||
Face *face;
|
||||
@@ -31,7 +33,7 @@ void setup(void) {
|
||||
face->Expression.GoTo_Normal();
|
||||
|
||||
// Assign a weight to each emotion
|
||||
face->Behavior.SetEmotion(eEmotions::Normal, 1.0);
|
||||
//face->Behavior.SetEmotion(eEmotions::Normal, 1.0);
|
||||
//face->Behavior.SetEmotion(eEmotions::Angry, 1.0);
|
||||
//face->Behavior.SetEmotion(eEmotions::Sad, 1.0);
|
||||
// Automatically switch between behaviours (selecting new behaviour randomly based on the weight assigned to each emotion)
|
||||
@@ -67,7 +69,7 @@ void loop(){
|
||||
int yRaw = analogRead(25);
|
||||
int xRaw = analogRead(26);
|
||||
float y = mapFloat(yRaw, 0, 4095, 1.0, -1.0);
|
||||
float x = mapFloat(xRaw, 0, 4095, 1.0, -1.0);
|
||||
float x = mapFloat(xRaw, 0, 4095, -1.0, 1.0);
|
||||
face->Look.LookAt(x, y);
|
||||
lastMoveTime = millis();
|
||||
}
|
||||
@@ -76,12 +78,12 @@ void loop(){
|
||||
face->DoBlink();
|
||||
}
|
||||
|
||||
/*
|
||||
// Use this code to set a particular emotion from a button
|
||||
int32_t potValue = analogRead(15);
|
||||
float anger = map(potValue, 0, 4095, 0.0, 2.0);
|
||||
face->Behavior.SetEmotion(eEmotions::Angry, anger);
|
||||
*/
|
||||
for(int i=0; i<3; i++){
|
||||
int32_t potValue = analogRead(moodPins[i]);
|
||||
float moodLevel = map(potValue, 0, 4095, 0.0, 2.0);
|
||||
face->Behavior.SetEmotion(moods[i], moodLevel);
|
||||
}
|
||||
|
||||
// Update the face!
|
||||
face->Update();
|
||||
|
||||
Reference in New Issue
Block a user