openmv/usr/examples/03-Drawing/set_pixel.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

30 lines
638 B
Python

import sensor, time
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)
# Capture image and set pixels
image = sensor.snapshot()
for y in range(0, 240):
for x in range(0, 320):
image.set_pixel(x, y, 0xFF)
time.sleep(1000)
# Switch to RGB565
sensor.set_pixformat(sensor.RGB565)
# Capture image and set pixels
image = sensor.snapshot()
for y in range(0, 240):
for x in range(0, 320):
image.set_pixel(x, y, (0xFF, 0x00, 0x00))