kopia lustrzana https://github.com/RobertGawron/IonizationChamber
				
				
				
			directory structure update
							rodzic
							
								
									4b51b0804c
								
							
						
					
					
						commit
						d09eed135f
					
				| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
from serial import Serial
 | 
			
		||||
import datetime
 | 
			
		||||
 | 
			
		||||
ser = Serial('/dev/serial/by-id/usb-STMicroelectronics_STM32_STLink_066AFF363732594D43214443-if02',  baudrate=115200)
 | 
			
		||||
 | 
			
		||||
ser.isOpen()
 | 
			
		||||
logFile = open('data.log', 'w')
 | 
			
		||||
logFile.write("Time,Counter\n")
 | 
			
		||||
 | 
			
		||||
while True:
 | 
			
		||||
    dataIn = int(ser.readline().rstrip())
 | 
			
		||||
    now = datetime.datetime.now()
 | 
			
		||||
    logFile.write("{0},{1}\n".format(now, dataIn))
 | 
			
		||||
    logFile.flush()
 | 
			
		||||
 | 
			
		||||
    print(dataIn)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
library(latticeExtra)
 | 
			
		||||
require(gridExtra)
 | 
			
		||||
require(grid)
 | 
			
		||||
 | 
			
		||||
# set error messages test to english
 | 
			
		||||
Sys.setenv(LANG = "en")
 | 
			
		||||
 | 
			
		||||
#load samples
 | 
			
		||||
samples <- read.delim("data.log", , sep=",")
 | 
			
		||||
 | 
			
		||||
# date column should be type of date, not string, so parse it
 | 
			
		||||
png(filename = paste0("results-", format(Sys.time(), "%d_%b_%Y_%H_%M"), ".png"), width = 800, height = 900, bg = "white")
 | 
			
		||||
 | 
			
		||||
# create graphs
 | 
			
		||||
 | 
			
		||||
samples$Time = as.POSIXct(samples$Time, format="%Y-%m-%d %H:%M:%S.%OS")
 | 
			
		||||
 | 
			
		||||
# create graphs
 | 
			
		||||
plotValueVsTime <- xyplot(Counter ~ Time, 
 | 
			
		||||
                data = samples, 
 | 
			
		||||
                type = "l", 
 | 
			
		||||
                grid = TRUE, 
 | 
			
		||||
                col.line = "black",
 | 
			
		||||
                ylab = "counts per minute",
 | 
			
		||||
		ylim=c(min(samples$Counter), max(samples$Counter)),
 | 
			
		||||
 | 
			
		||||
                xlim=c(min(samples$Time), max(samples$Time)),
 | 
			
		||||
                main = "Change over time")
 | 
			
		||||
 | 
			
		||||
plotHistogram <- histogram(samples$Counter, 
 | 
			
		||||
                           color = "white", 
 | 
			
		||||
                           col = "grey", 
 | 
			
		||||
                           xlab = "counts", 
 | 
			
		||||
                           ylab = "percentage", 
 | 
			
		||||
                           main = "Histogram")
 | 
			
		||||
 | 
			
		||||
# show graphs
 | 
			
		||||
grid.arrange(plotValueVsTime, plotHistogram, nrow = 2)
 | 
			
		||||
 | 
			
		||||
# add timestamp
 | 
			
		||||
trellis.focus("toplevel")
 | 
			
		||||
pictureCreationTimestamp <- as.POSIXlt(Sys.time())
 | 
			
		||||
panel.text(0.85, 0.03, pictureCreationTimestamp, cex = 1.2, font = 2)
 | 
			
		||||
trellis.unfocus()
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ void VoltageSensorActualValue_Init()
 | 
			
		|||
 | 
			
		||||
bool VoltageSensorActualValue_GetMeasurementData(VoltageSensorActualValue_MeasurementData_t *measurementData)
 | 
			
		||||
{
 | 
			
		||||
    *measurementData = getRegisterValue(0x00);
 | 
			
		||||
    *measurementData = getRegisterValue(0x01);
 | 
			
		||||
 | 
			
		||||
    if (*measurementData == 0)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue