Thymiopositionanglais

Diese Seite stellt ein Beispiel ihnen vor wo der Thymio II etwas auf englisch sagt.

Mehrere Positionen (auf der Seite , auf der Rückseite … ) wurden mit einer Audio- Beschreibung zugeordnet . Der Benutzer muss verstehen, was Thymio II sagt und legt ihn in die richtige Position um ihn " glücklich " zu machen. Das folgende Video zeigt das resultierende Verhalten und die entsprechende Manipulation :

Um dieses Verhalten zu erhalten, muss der Roboter mit einer Reihe von Audiodateien ausgestattet werden und er muss programmiert sein microSD card in dem Roboter eingesetzt . Die Dateien auf der SD- Karte abgelegt werden, können in dieser gefunden werdenZIP archive. Kopieren Sie einfach den Inhalt des ZIP-Archivs auf die SD -Karte und programmieren die Roboter mit dem folgenden Code:

var etat
 etat=0
 call sound.play(6)
onevent prox
if etat==0 then      # normal state

  when button.backward==1 do #want to be vertical
      call sound.play(17)
      call leds.top(0,0,32)
      etat=5
   end
   when  button.left==1 do #want to be on the left side
      call sound.play(11)
      call leds.top(0,32,32)
      etat=4
   end
   when button.right==1 do #want to be on the right side
      call sound.play(12)
      call leds.top(32,32,0)
      etat=3
   end
   when  button.forward==1 do #hide the eyes
      call sound.play(10)
      call leds.top(0,32,0)
      etat=2
   end
   when button.center==1 do #on the back
      call sound.play(2)
      call leds.top(32,0,0) 
      etat=1
   end
end

if etat==1 then #robot red, on the back
  when acc[2]<-19  do # back to normal state
    call sound.play(18)
    call leds.top(0,0,0)
    etat=0
  end
end

if  etat==2 then  #hide the eyes
   when prox.horizontal[0]>1 and   prox.horizontal[1]>1 and prox.horizontal[2]>1 
and prox.horizontal[3]>1 and prox.horizontal[4]>1 do  #back to normal state
      call sound.play(18)
      call leds.top(0,0,0)
      etat=0
    end
end

if  etat==3 then #right side
    when acc[0]<-18  do  #back to normal state
       call sound.play(8)
       call leds.top(0,0,0)
       etat=0
    end
end

if  etat==4 then #left side
    when acc[0]>22   do #back to normal state
       call sound.play(8)
       call leds.top(0,0,0)
       etat=0
    end
end

if  etat==5 then # vertical
    when acc[1]>19 do # back to normal state
       call sound.play(9)
       call leds.top(0,0,0)
       etat=0
    end
end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License