openmv/usr/examples/03-Drawing/drawing.py
Kwabena W. Agyeman 94bc225542 Moved examples arround.
Tried to emulate Arduino's 11 folders... I'd perfer to have all the
shield scripts in one folder... but, that might not make sense. I don't
really want one script per folder however. So, I might merge some more
stuff in the future. I have a grand idea here that will become evident as
I work though the examples.

Anyway, the current structure is not final. It will be in flux for a
little while.

As for Git History, folder history is the best we're going to get. Git
and GitHub don't seem to deal with moves too well.
2016-03-30 21:30:11 -04:00

28 lines
689 B
Python

import sensor
from math import sin, cos
sensor.reset()
# Set sensor settings
sensor.set_brightness(0)
sensor.set_saturation(0)
sensor.set_gainceiling(8)
sensor.set_contrast(2)
# Set sensor pixel format
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
# Skip a few frames to allow the sensor settle down
for i in range(0, 3):
image = sensor.snapshot()
x = int(320/2)
y = int(240/2)
image.draw_circle(x, y, 50)
image.draw_line((x, y, int(50*sin(45))+x, int(50*cos(45))+y))
image.draw_rectangle((x-60, y-60, 120, 120))
image.draw_string(10, 10, "OpenMV", color = 0xFF)
image.draw_string(10, 25, "Hello World", color = 0xFF)
# Flush buffer...
sensor.snapshot()