Part 5: Welcome TI-Innovator – Ultrasonic sensor

  • Instructions - How you can connect and read ultrasonic sensor?
  • Send "CONNECT RANGER 1 TO IN 1"
    Wait 1
    For n,1,50
     Send "READ RANGER 1"
     Get a
     Disp a
     Wait 0.2
    EndFor

    Write the code and test that it is working right. For example you could measure the height of table.

    Näyttökuva 2017-03-19 kello 19.39.43

  • Exercise - Car Collision Warning

    Your work

    Write a program that it gives warning sound if distance is too low (collision warning).

     

    You may need

    • For statements
    • If...Else statements
  • Solutions

    TI-Basic Code

    Send "CONNECT RANGER 1 TO IN 1"
    Wait 1:For n,1,50
     Send "READ RANGER 1"
     Get a
     If a<0.3 Then
       Send "SET SOUND 400 TIME 1"
     EndIf
     Disp a
     Wait 0.2
    EndFor

    Notice: You can't copy-paste it because it includes HTML formattings