Skip to content
Snippets Groups Projects
Commit b3b87f95 authored by michael.divia's avatar michael.divia
Browse files

UART North & South working

parent 25887f6a
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ gpio_neopixel = 0 ...@@ -8,7 +8,7 @@ gpio_neopixel = 0
np = NeoPixel(Pin(gpio_neopixel, Pin.OUT), nb_line*nb_row) np = NeoPixel(Pin(gpio_neopixel, Pin.OUT), nb_line*nb_row)
class color: class Color:
BLACK = (0, 0, 0) BLACK = (0, 0, 0)
BLUE = (0, 0, 255) BLUE = (0, 0, 255)
CYAN = (0, 255, 255) CYAN = (0, 255, 255)
...@@ -43,7 +43,7 @@ class color: ...@@ -43,7 +43,7 @@ class color:
ORANGE = (255, 128, 0) ORANGE = (255, 128, 0)
ORANGE_YELLOW = (255, 204, 0) ORANGE_YELLOW = (255, 204, 0)
class direction: class Direction:
NORTH = 1 NORTH = 1
SOUTH = 2 SOUTH = 2
EAST = 4 EAST = 4
...@@ -156,7 +156,7 @@ def color_convert(color): ...@@ -156,7 +156,7 @@ def color_convert(color):
return color return color
class matrix: class Matrix:
def clear(color): def clear(color):
...@@ -235,7 +235,7 @@ class matrix: ...@@ -235,7 +235,7 @@ class matrix:
return hex_color return hex_color
def afficher_texte(text, color, speed): def show_text(text, color, speed):
# Clear the screen # Clear the screen
matrix.clear(0) matrix.clear(0)
...@@ -266,7 +266,7 @@ def afficher_texte(text, color, speed): ...@@ -266,7 +266,7 @@ def afficher_texte(text, color, speed):
printColumn(step + i, i, text) printColumn(step + i, i, text)
utime.sleep(speed) utime.sleep(speed)
class uart: class Uart:
channel = None channel = None
...@@ -287,13 +287,20 @@ class uart: ...@@ -287,13 +287,20 @@ class uart:
def sendline(self, data): def sendline(self, data):
self.channel.write(data+'\n') self.channel.write(data+'\n')
def receive(self, nbyte=1): def receive(self, length=1):
return self.channel.read(nbyte) data = None
while data == None or not len(data) == length:
data = self.channel.read(length)
if data is None:
utime.sleep(0.1)
return data
def receiveline(self): def receiveline(self):
data = None data = None
while data == None: while data is None or not data.endswith(b'\n'):
data = self.channel.readline() data = self.channel.readline()
if data is None:
utime.sleep(0.1)
return data return data
def christmas(): def christmas():
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
- [Travail](#travail) - [Travail](#travail)
- [Lundi, 17 Juin 2024](#lundi-17-juin-2024) - [Lundi, 17 Juin 2024](#lundi-17-juin-2024)
- [Mardi, 18 Juin 2024](#mardi-18-juin-2024) - [Mardi, 18 Juin 2024](#mardi-18-juin-2024)
- [Mercredi, 19 Juin 2024](#mercredi-19-juin-2024)
- [Creators](#creators) - [Creators](#creators)
- [Copyright and license](#copyright-and-license) - [Copyright and license](#copyright-and-license)
...@@ -50,6 +51,12 @@ J'ai ensuite créer un fonction de démo `christmas` afin de démontré le bon f ...@@ -50,6 +51,12 @@ J'ai ensuite créer un fonction de démo `christmas` afin de démontré le bon f
Suite à cela nous avons, à l'aide de M. Escribano, à implémenter les fonction `UART` suivante : `send`, `snedline`, `receive` et `receiveline` et nous avons commencé à les tester entre 2 cartes mais nous avons eux quelque problème, nous allons donc devoir continuer à investiguer cela demain. Suite à cela nous avons, à l'aide de M. Escribano, à implémenter les fonction `UART` suivante : `send`, `snedline`, `receive` et `receiveline` et nous avons commencé à les tester entre 2 cartes mais nous avons eux quelque problème, nous allons donc devoir continuer à investiguer cela demain.
## Mercredi, 19 Juin 2024
A l'aide de M. Escribano nous avons finalisé la correction des fonctions `receive` et `receiveline` afin de pouvoir communiqué en `UART` entre 2 cartes en utilisant les ports prévu à cet effet sur les RPI Pico (`NORTH` et `SOUTH` dans notre code).
Nous avons ensuite enchaîner avec la communication `UART` via les `GPIO`.
# Creators # Creators
**Michael Divià** **Michael Divià**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment