Sensing the void – 19 May 2017

Introduce the students to the function Void

  • Using the function Void to simplify our code.
  • Setup void functions for motors moving forward at full power, half power, off and point turn.
  • Write code that now uses void to get the robot to move forward, point turn and return.
  • Include void functions for the arm and claw.

Introduction to sensors

  • Differences between analog and digital – graph
  • Conversion of analog to digital and vice versa
  • Push button 1/0 on & off
  • Simple single pulse encoder
    • sensing distance and speed
  • Double offset pulse (quadrature)
    • sensing distance, speed and direction
  • Write up blogs, finish mugs, 1st finished to format and partition our 4 500GB drives

Autobot’s rollout – 12 May 2017

  • Introduce students to Robot C who weren’t present last session.
  • Break down of the code structure/syntax.
  • The importance of correct punctuation and upper/lower case when coding.
  • Remarking // commenting /**/ on each line of code while learning.
  • Show how to configure Pragmas for each individual motor including speed and reversing.
  • Demonstrate writing a basic code to enable the robot to drive forward, point turn and return with wait times included. Explain the reason why we power down the motors.
#pragma config(Motor, port1, rightMotor, tmotorVex393_HBridge, openLoop, driveRight)

#pragma config(Motor, port10, leftMotor, tmotorVex393_HBridge, openLoop, reversed, driveLeft)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
/*

Steve's experimental robot

Robot will wait, move forward, wait, 180 deg point turn, wait, move forward back to where it started.

*/

wait1Msec (6000); // This command will cause the program to 'wait' for 6 sec before executing so we have time to put the robot down

motor [rightMotor] = 127; // This command will turn on the right motor at full power of 127
motor [leftMotor] = 127; // This command will turn on the left motor at full power of 127
wait1Msec (6000); // This command will cause the motors to run for 6 sec

motor [rightMotor] = 0; // This command will turn off the right motor
motor [leftMotor] = 0; // This command will turn off the left motor
wait1Msec (1000); // This command will keep the motors turned off for 1 sec

motor [rightMotor] = 63; // This command will turn on the right motor at half power of 63
motor [leftMotor] = -63; // This command will turn on the left motor at half power of 63 but reversed so that it will perform a point turn
wait1Msec (2000); // This command will cause the motors to run for 2 sec

motor [rightMotor] = 0; // This command will turn off the right motor
motor [leftMotor] = 0; // This command will turn off the left motor
wait1Msec (1000); // This command will keep the motors turned off for 1 sec

motor [rightMotor] = 127; // This command will turn on the right motor at full power of 127
motor [leftMotor] = 127; // This command will turn on the left motor at full power of 127
wait1Msec (6000); // This command will cause the motors to run for 6 sec

}

 

 

  • Students to start setting up pragmas for the claw and arm motors, noting that these needed speed controllers as only two ports have these built into the Cortex.
  • Write code that includes operating these extra two motors.
  • Capture and write up their blogs.

Welcome to the Machine – 5 May 2017

Day Planner

  • Welcome back – Term 2
  • Introduction to programming:

Machine code – What language processors understand

Compiler / Assembler (Robot C)  – Converting English to Hex

  • Introduce students to http://www.education.rec.ri.cmu.edu/products/cortex_video_trainer/index.html
    • Task students to write and upload code to make the Clawbot move forward for a set time, turn 180 and return.  Code should have correct syntax and notated. Students to make record of this (screenshot/video). Use EIT online weeks 5-8.
    • Sensors – Students to include a push button sensor and write code that causes the Clawbot to move backwards and perform a 180 when the button contacts the wall.
  • Blender – Students to include their name or a design on their mug and export the file as an .stl ready for print.
  • 3D printing / slicing – Introduction to 3D printing.
  • Students to write up their blog.