Telling Time

Linkbot Image Mindstorm Image Cursor Image
0x126-6-12y126-6-12
Grid:
Tics Lines:
Width px
Hash Lines:
Width px
Labels:
Font px
Trace Lines:
Robot 1:
Width px
Robot 2:
Width px
Robot 3:
Width px
Robot 4:
Width px
Axes: x-axis y-axis Show Grid
Grid: 24x24 inches 36x36 inches 72x72 inches
96x96 inches 192x192 inches
Quad: 4 quadrants 1 quadrant Hardware
Units: US Customary Metric
Background: Background Image

Robot 1

Linkbot
Mindstorm
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (0 in, 0 in)
Current Angle: 0 deg
Wheel Radius:
Track Width:
in

Robot 2

Linkbot
Mindstorm
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (0 in, 4 in)
Current Angle: 0 deg
Wheel Radius:
Track Width:
in

Robot 3

Linkbot
Mindstorm
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (0 in, 8 in)
Current Angle: 0 deg
Wheel Radius:
Track Width:
in

Robot 4

Linkbot
Mindstorm
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (0 in, 12 in)
Current Angle: 0 deg
Wheel Radius:
Track Width:
in

Learning the Clock (Hour Hand)
Problem Statement:

Run the code and input value to watch the hour hand of a clock in action

/* Code generated by RoboBlockly v2.0 */
#include <chplot.h>
double hour;
CPlot plot;

// Describe this function...
void Winding_the_Clock() {
  double i;
  double i_inc = 0.05;
  if (0 > hour) {
    i_inc = -i_inc;
  }
  i = 0;
  while(i_inc >= 0 ? i <= hour : i >= hour) {
    //plot.backgroundImage("./Background.png");
    plot.strokeColor("black");
    plot.line(0, 0, 0, 7.2);
    plot.strokeColor("red");
    plot.line(0, 0, 6 * cos(deg2rad((90 - i * 30))), 6 * sin(deg2rad((90 - i * 30))));
    delaySeconds(0.01);
    i += i_inc;
  }
  //plot.backgroundImage("./Background.png");
  plot.strokeColor("black");
  plot.line(0, 0, 0, 7.2);
  plot.strokeColor("red");
  plot.line(0, 0, round((6 * cos(deg2rad((90 - hour * 30))))), round((6 * sin(deg2rad((90 - hour * 30))))));
}

// Example: It's 3 o'clock. Input 3 into the prompt
plot.strokeWidth(6);
plot.strokeColor("black");
plot.line(0, 0, 0, 7.2);
plot.strokeColor("red");
plot.line(0, 0, 0, 6);
delaySeconds(0.1);
hour = 3;
Winding_the_Clock();

plot.label(PLOT_AXIS_XY, "");
plot.grid(PLOT_OFF);
plot.tics(PLOT_AXIS_XY, PLOT_OFF);
plot.axis(PLOT_AXIS_XY, PLOT_OFF);
plot.axisRange(PLOT_AXIS_XY, -12, 12);
plot.ticsRange(PLOT_AXIS_XY, 2);
plot.sizeRatio(1);
plot.plotting();
Blocks Save Blocks Load Blocks Show Ch Save Ch Workspace
Problem Statement:

Run the code and input value to watch the hour hand of a clock in action


		
Rubbish bin
Time