Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Alex.cpp
00001 #include "Alex.h" 00002 00003 Alex::Alex(SRF05 s, Servo e, Servo m, Servo l, Servo r):S(s), E(e), M(m), L(l), R(r), Led(LED1), pc(USBTX, USBRX) 00004 { 00005 } 00006 Alex::~Alex() 00007 { 00008 } 00009 void Alex::TestHead() 00010 { 00011 Led=1; 00012 wait(0.02); 00013 Led=0; 00014 } 00015 int Alex::Testpresence() 00016 { 00017 if((S.read()==0)||(S.read()>=500)){return 0;}//if presence is too close, return 0 00018 if(S.read()>=40){return 1;}//if presence is too far, return 1 00019 if((S.read()>=0)&&(S.read()<=40)){return 2;}//if presence is between O and 40cm, return 2 00020 return 0; 00021 } 00022 void Alex::Move_eyes(int valuee) 00023 { 00024 for(int i=0; i<valuee; i++) 00025 { 00026 E=i; 00027 wait(0.1); 00028 } 00029 } 00030 void Alex::Move_mouth(int valuem) 00031 { 00032 for(int i=0; i<valuem; i++) 00033 { 00034 M=i; 00035 wait(0.1); 00036 } 00037 } 00038 void Alex::Move_leaning(int valuel) 00039 { 00040 for(int i=0; i<valuel; i++) 00041 { 00042 L=i; 00043 wait(0.1); 00044 } 00045 } 00046 void Alex::Move_rotation(int valuer) 00047 { 00048 for(int i=0; i<valuer; i++) 00049 { 00050 R=i; 00051 wait(0.1); 00052 } 00053 } 00054 /* 00055 //void Alex::Simulate_Talking(int length) 00056 { 00057 //for(int i=0; i<length; i++) 00058 { 00059 // Move_mouth(100); 00060 // wait(0.01); 00061 } 00062 } 00063 00064 //void Alex::Presence_too_far() 00065 { 00066 // pc.printf("You are too far, I can't see you !"); 00067 // Simulate_Talking(4); 00068 //wait(3); 00069 // pc.printf("Is there somebody ?"); 00070 // Simulate_Talking(4); 00071 // wait(3); 00072 } 00073 //void Alex::displaydistance() 00074 { 00075 // pc.printf("Distance : %4i\r\n", S.read()); 00076 } 00077 00078 //void Alex::Presence_too_close() 00079 { 00080 //pc.printf("You are too close, please move back"); 00081 //Simulate_Talking(4); 00082 // wait(3); 00083 }*/
Generated on Mon Jul 18 2022 07:57:14 by
1.7.2