Software and click Downloads.
1
2
3
4
5
// the setup function runs once when you press reset or power the board
void setup(){
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
1
2
3
4
5
6
7
8
// the loop function runs over and over again forever
void loop(){
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
hello_word.ino sketch click through the serial monitor. COPY_THE_EXADECIMALDIGITS_HERE in the segment of code below, and run the code inside a notebook.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from matplotlib import pyplot as plt
import numpy as np
import struct
HEXADECIMAL_BYTES=[COPY_THE_EXADECIMALDIGITS_HERE]
# Reformat the bytes into an image
raw_bytes = np.array(HEXADECIMAL_BYTES, dtype="i2")
image = np.zeros((len(raw_bytes),3), dtype=int)
# Loop through all of the pixels and form the image
for i in range(len(raw_bytes)):
#Read 16-bit pixel
pixel = struct.unpack('>h', raw_bytes[i])[0]
#Convert RGB565 to RGB 24-bit
r = ((pixel >> 11) & 0x1f) << 3;
g = ((pixel >> 5) & 0x3f) << 2;
b = ((pixel >> 0) & 0x1f) << 3;
image[i] = [r,g,b]
image = np.reshape(image,(144, 176,3)) #QCIF resolution
# Show the image
plt.imshow(image)
plt.show()