YEAR 9 DIGITAL TECHNOLOGY
  • Unit A - Computer Science
    • Light Bot
    • Basic Programming
    • If Statements
    • Programming Assessment
  • Unit B - Digital Media
    • Pixel Art
    • Pixel Animation
    • Photo editing
  • Bonus Learning
    • 3D Modelling
    • Video Editing
    • Introduction to Python
  • Freyberg Digital

Morse Code Project

Picture
Picture

Traffic Light Activity

Picture
Picture

Servo Motors

Picture
Picture
Picture
Picture

Code for the Continuous Servo Motor 

As per the diagram above:

0 degrees goes anti clockwise
​90 degrees goes in no direction
​180 degrees goes in a clock wise direction

​This looks like

​servo.write(0);
​servo.write(90);
​servo.write(180);
Task - Make the spin forward exactly 3 cycles forward and then 3 cycles back and stop for 3 seconds
Use the Sweep example for this... Examples --> Servo --> seep
Picture

Ultra Sonic Sensor

Picture
Picture

The Code

Picture
This code will take in the sound input and pump out measurements.
Picture
Press this button to monitor the results from the ultra sonic sensor.
long duration;
int distance;
void setup() {
 pinMode(5, OUTPUT);
 pinMode(6, INPUT);
 Serial.begin(9600);
}
void loop() {
  digitalWrite(5, LOW);
  delayMicroseconds(2);
 
  digitalWrite(5, HIGH);
  delayMicroseconds(10);
  digitalWrite(5, LOW);
  duration = pulseIn(6, HIGH);
  distance = duration*0.034/2;
  Serial.print("Distance: ");
  Serial.println(distance);
}

Now the Additional Tasks
​1. Plug a bulb in and make it so it lights  up if the sensor is under 10cm
2.Plug another bulb in and make it so it lights  up if the sensor is under 30cm

​Hint: Both bulbs should light up if under 10cm

You Might need this code:

if ( distance < 10){
    
  } else {
   
  }



Powered by Create your own unique website with customizable templates.
  • Unit A - Computer Science
    • Light Bot
    • Basic Programming
    • If Statements
    • Programming Assessment
  • Unit B - Digital Media
    • Pixel Art
    • Pixel Animation
    • Photo editing
  • Bonus Learning
    • 3D Modelling
    • Video Editing
    • Introduction to Python
  • Freyberg Digital