Vex IQ Snake

A fully functional robotic snake that hisses and runs from you when you touch its tail and try to pet it :snake:

vex snake 3

vex snake

vex snake 2

This is a video.
https://photos.google.com/photo/AF1QipMu6Zn6OUvpJfDpLPsVHtqrRoGet92ITzvzuSwK

25 Likes

That’s really cool. Can you post a video?

4 Likes

That’s really neat, nice job!

4 Likes

Snek

5 Likes

That is one of the coolest creations! Nice job!

5 Likes

Very nice, my favorite VEX builds are becoming robots or mechanisms that are really cool. Your snek is on that list.

One of the things about Lego is people build all sorts of things with Lego. Having VEX builders extend their skills past the games is awesome. The parts are so versatile, it’s a shame that lots of people here look at them with such a narrow view.

3 Likes

I’ve got a video posted! I’m trying to find a way to post instructions but no luck so far.

here’s the code. Not the cleanest but works!

 {

#pragma config(Sensor, port4,  dis,            sensorVexIQ_Distance)
#pragma config(Sensor, port5,  tail,           sensorVexIQ_Touch)
#pragma config(Sensor, port6,  led,            sensorNone)
#pragma config(Motor,  motor7,          turn,          tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor,  motor12,         slither,       tmotorVexIQ, PIDControl, reversed, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{

int hiss;

repeat(forever)
{
  setMotorSpeed(slither, getJoystickValue(ChD));
  hiss = getDistanceValue(dis);
if (getJoystickValue(BtnLUp) == 1)
{
  setMotor(turn, 10);
}
else
{
  if (getJoystickValue(BtnLDown) == 1)
  {
    setMotor(turn, -10);
  }
  else
  {
   if (hiss <= 150)
   {
     
     setTouchLEDColor(led, colorRed);
     setTouchLEDBlinkTime(led, 2, 2);
     playSound(soundAirWrench);
     wait1Msec(3000);
     
     
   }
   else
   {
     if (getBumperValue(tail) == 1)
     {
       playSound(soundAirWrench);
       setTouchLEDColor(led, colorRed);
       setTouchLEDBlinkTime(led, 2, 2);
       wait1Msec(450);
       setMotor(slither, 100);
       wait1Msec(1500);
       stopMotor(slither);
       
       
     }
     else
     {
       setMotorTarget(turn, 0, 15);
     }
     
     
   }
   
  }
  setTouchLEDColor(led, colorBlue);
  setTouchLEDBlinkTime(led, 2, 2);
}
}
}


             }
2 Likes

Can you put your code in code blocks please?

Nice snake!! Must be a lot of fun playing with it during quarantine :rofl:

1 Like

I’m afraid i can’t convert my code into blocks… Sorry.

That is an excellent snake! I might have to try that out…

2 Likes

I meant to put [code] at the beginning

and [/code] at the end. It is a forum thing that formats it nicely so people can read it easily.

I wasn’t really sure how you drove this until looking at the code and realizing that one motor ran the front differential and the second motor was moving the tail from side to side. That side move makes the head turn and the differential keeps it all even.

If you’ve loaded your video to youtube, etc. you just use the link button (the chains) to put into the body of the text.

2 Likes