User Tools

Site Tools


arduino:vl53l0x

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
arduino:vl53l0x [2019/03/03 12:16] – aistisarduino:vl53l0x [2025/06/02 22:29] (current) – aistis
Line 1: Line 1:
 +{{:arduino:pasted:20250602-222933.png}}
 +
 VL53L0X 940nm  VL53L0X 940nm 
  
Line 15: Line 17:
 from matplotlib import pyplot as plt from matplotlib import pyplot as plt
  
-s = serial.Serial(port='COM6', baudrate=9600)+s = serial.Serial(port='COM6', baudrate=9600) #data will come in 9 byte chunks every 500ms or so , byte 5 is distance in cm
 time.sleep(0.1) time.sleep(0.1)
-while s.in_waiting == 0: time.sleep(0.01) +while s.in_waiting == 0: time.sleep(0.01) #wait for first byte to arrive 
-while s.in_waiting != 0:+while s.in_waiting != 0: #skip bytes until pause
     s.read(1)     s.read(1)
     time.sleep(0.01)     time.sleep(0.01)
Line 24: Line 26:
 x = np.arange(100) x = np.arange(100)
 y = np.zeros(100) y = np.zeros(100)
-# y = np.full([100], np.nan) 
  
 plt.ion() plt.ion()
- 
 fig = plt.figure(1) fig = plt.figure(1)
 plt.ylim(ymax=250, ymin=0) plt.ylim(ymax=250, ymin=0)
arduino/vl53l0x.1551608191.txt.gz · Last modified: by aistis