teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

noudayの場所変更

2021/09/02 03:50

投稿

F91_
F91_

スコア16

answer CHANGED
@@ -92,9 +92,9 @@
92
92
  try:
93
93
  inputVal0=readadc(0,SPICLK,SPIMOSI,SPIMISO,SPICS)# CH0の信号を取得する プログラム運転(緑)
94
94
  inputVal1=readadc(1,SPICLK,SPIMOSI,SPIMISO,SPICS)#アラーム(赤)
95
- if inputVal0 > 2000 or inputVal1 > 2000:#on/offを判断する光量を変更(緑)
96
95
  now=datetime.datetime.now()
97
96
  nowday='{0:%Y%m%d}'.format(now)#日付でcsv保存するため
97
+ if inputVal0 > 2000 or inputVal1 > 2000:#on/offを判断する光量を変更(緑)
98
98
  #print(inputVal0)
99
99
  time1=time1+1
100
100
  print('稼働中')

2

noudayの場所変更

2021/09/02 03:50

投稿

F91_
F91_

スコア16

answer CHANGED
@@ -86,14 +86,15 @@
86
86
  mpl.rcParams['toolbar'] = 'None'
87
87
  fig = plt.figure(figsize=(8.7, 3.5))
88
88
  ax = fig.add_subplot()
89
- now=datetime.datetime.now()
90
- nowday='{0:%Y%m%d}'.format(now)#日付でcsv保存するため
91
89
 
90
+
92
91
  while True:
93
92
  try:
94
93
  inputVal0=readadc(0,SPICLK,SPIMOSI,SPIMISO,SPICS)# CH0の信号を取得する プログラム運転(緑)
95
94
  inputVal1=readadc(1,SPICLK,SPIMOSI,SPIMISO,SPICS)#アラーム(赤)
96
95
  if inputVal0 > 2000 or inputVal1 > 2000:#on/offを判断する光量を変更(緑)
96
+ now=datetime.datetime.now()
97
+ nowday='{0:%Y%m%d}'.format(now)#日付でcsv保存するため
97
98
  #print(inputVal0)
98
99
  time1=time1+1
99
100
  print('稼働中')

1

plt.clf()を追加

2021/09/02 03:24

投稿

F91_
F91_

スコア16

answer CHANGED
@@ -7,6 +7,7 @@
7
7
  import matplotlib.pyplot as plt
8
8
  import matplotlib.dates as mdates
9
9
  from time import sleep
10
+ import matplotlib as mpl
10
11
 
11
12
  start=time.time()
12
13
  dissolution=1 #計測分解能[s]
@@ -76,11 +77,14 @@
76
77
  plt.gca().xaxis.set_major_locator(mdates.HourLocator(interval=1))
77
78
  plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
78
79
  plt.gca().set_xlim(left=datetime.datetime(d_today.year, d_today.month, d_today.day, 7, 0),right=dt_end)
79
- plt.tight_layout()
80
+ plt.gca().set_yticks([])
80
81
  plt.draw()
82
+ plt.subplots_adjust(left=0.03, right=0.97, bottom=0.2, top=1)
81
83
  plt.pause(1)
84
+ plt.clf()
82
85
 
86
+ mpl.rcParams['toolbar'] = 'None'
83
- fig = plt.figure(figsize=(12.8, 4.8))
87
+ fig = plt.figure(figsize=(8.7, 3.5))
84
88
  ax = fig.add_subplot()
85
89
  now=datetime.datetime.now()
86
90
  nowday='{0:%Y%m%d}'.format(now)#日付でcsv保存するため
@@ -95,7 +99,7 @@
95
99
  print('稼働中')
96
100
  print(now.strftime('%H:%M'))
97
101
  print(time1)
98
- if time1==1:
102
+ if time1>=60:
99
103
  plot_operation(fig, ax)
100
104
  time1=0
101
105
 
@@ -109,6 +113,7 @@
109
113
  continue
110
114
  except KeyboardInterrupt:
111
115
  break
116
+
112
117
  ```
113
118
 
114
119
  ![イメージ説明](acbc342535698b5af7e531d515ccc97d.png)