You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanna to store R G B from a color sensor but i get it in one column R G B R G B ....... order , so i try to use dataframe method to store R G B value in different column but i get error
#47
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
import serial
import datetime
import time
import csv
import pandas as pd
ser= serial.Serial(port="COM5",baudrate=9600,timeout=20)
SCREEN_DISPLAY = True
SAVE_TO_FILE= True
DELIMITER=','
file_name = 'Sensor_data_3_1_1.csv'
fid=open(file_name,'ab')
filename="Sensor_data_3_1_1.csv"
for i in range(100):
b = ser.readline()
string_n = b.decode()
time_now=time.strftime("%Y-%m-%d %H: %M:%S")
DELIMITER=','
Data=(string_n,DELIMITER,time_now)
df = pd.DataFrame({Data})
fid.close()
ser.close()
Beta Was this translation helpful? Give feedback.
All reactions