PROGRAMMING SCHOOL
ProgBlox Set - examples
1. Example 1 - Ramp - 1 limit switch5. Example 4 - A vehicle with bumpers - an advanced example
2. Example 2 - Ramp - 2 limit switches6. Exemple 5 - Vehicle - Car set - supplemented example 15 (1)
3. Ramp - saved program from example 27. Exemple 6 - Vehicle - Car set - supplemented example 15 (2)
4. Example 3 - The vehicle follows the light8. Example 7 - Vehicle - Car set - supplemented example 16 (1)

Example 1 - Ramp - 1 limit switch
Prim_EN_01.jpg
Za početak je potrebno upaliti LED svjetla ( crveno i zeleno ). 1. Prekidom signala ( foto senzor ) na žutom ulazu, gasi se crveno LED svijetlo i pokreće se motor koji podiže rampu. 2. Ako crveni ulaz ( tipkalo pritisnuto ) ima signal i žuti ulaz ( foto senzor ) ima signal, pričekaj dvije sekunde, pokreni motor u suprotnom smijeru i spuštaj rampu dvije sekunde. Zaustavi motor i upali crveno LED svjetlo. 3. Ako crveni ulaz ( tipkalo pritisnuto ) ima signal da zaustavi motor.

Example 2 - Ramp - 2 limit switches
Prim_EN_02.jpg
Za početak je potrebno upaliti LED svjetla ( crveno i zeleno ). 1. Prekidom signala ( foto senzor ) na žutom ulazu, gasi se crveno LED svijetlo i pokreće se motor koji podiže rampu. 2. Ako crveni ulaz ( tipkalo pritisnuto ) ima signal i žuti ulaz ( foto senzor ) ima signal, zaustavi motor, pričekaj dvije sekunde, pokreni motor u suprotnom smijeru, pričekaj ( spuštaj rampu ) dvije sekunde i upali crveno LED svjetlo. 3. Ako plavi ulaz ( tipkalo pritisnuto ) i žuti ulaz ( foto senzor ) imaju signal, zaustavlja motor.

Ramp - saved program from example 2
Run the saved program via the RUN button on the control module. Turn on the power of the module and briefly press the RUN button (until the LED lights up).

Example 3 - The vehicle follows the light
Prim_EN_03.jpg
For this exercise, we use two photosensors connected to the red and green input of the control module. The motors on the vehicle are connected to the red and green outputs of the control module. The logic is very simple. The light always comes from the left or right side of the vehicle. That is why the vehicle turns to the left or right when the light is detected individually. When both sensors detect the signal, the vehicle moves forward.

Example 4 - A vehicle with bumpers - an advanced example
Prim_EN_04.jpg
Assembled vehicle model from the new set with bumpers. The program is identical to that for the vehicle from the Car set (example 16), but supplemented with a subprogram for the situation when both sides of the bumper are pressed (turn circularly to the right).

Exemple 5 - Vehicle - Car set - supplemented example 15 (1)
We have added to Example 15 from the Car set a subroutine for the situation when the bumper is pressed directly. When both sides are pressed (red and green), the vehicle should turn to the right.

Exemple 6 - Vehicle - Car set - supplemented example 15 (2)
We have added to Example 15 from the Car set a subroutine for the situation when the bumper is pressed directly. When both sides are pressed (red and green), the vehicle decides whether to turn left or right (randomly).

Example 7 - Vehicle - Car set - supplemented example 16 (1)
We have added to Example 16 from the Car set a subroutine for the situation when the bumper is pressed directly. When both sides are pressed (red and green), the vehicle should turn to the right.