with my little prog i have error : object with buffer protocol required
can you help , thank
Code: Select all
from machine import Pin, ADC
import time
amp = ADC(Pin(34))# amperage du moteur
amp.atten(ADC.ATTN_11DB)
BTN = Pin(13, Pin.IN, Pin.PULL_UP)
a=0
b=0
while True:
time.sleep(0.25)
a = amp.read() * 0.000805
if a > b :
b=a
print(b)#amperage le plus fort
if BTN.value() == 0 :
f = open('a.txt', 'w') # Fichier ampere
f.write(b) # line 19
f.close()
break
Code: Select all
>>> import amp
1.46671
1.480395
1.491665
1.50374
1.520645
1.53111
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "amp.py", line 19, in <module>
TypeError: object with buffer protocol required