示例#1
0
 def to_uwester(self):
     self.freq_value_label.config(bg="red")
     # Send the frequency to microcontroller
     # Sends two messages, one to indicate that we are sending a frequency
     # the other to specify what frequency
     try:
         s.write(b'FREQ')
         s.write(b'%d' % self.tuned_freq)
     except:
         print("Unable to send")
示例#2
0
 def to_uwester(self):
     self.time_choice.config(bg="red")
     self.increment = 1
     period_to_send = self.periods[self.period_index]
     # if less than 20us
     if (self.period_index < 2):
         # thats too fast for ADC so:
         # send 20us to MCU
         period_to_send = self.periods[2]
         # and fix resolution in software instead
         if self.period_index == 1:
             self.increment = 2
         elif self.period_index == 0:
             self.increment = 4
         # Simplified
         # self.increment = 4 - 2 * self.period_index
     # Send the multiplier
     try:
         s.write(b'TIME')
         s.write(b'%d' % period_to_send)
     except:
         print("Unable to send")
示例#3
0
 def square(self):
     s.write(b'SQUARE')
示例#4
0
 def sine(self):
     s.write(b'SINE')
示例#5
0
 def led_off(self):
     s.write(b'LD2 OFF')
示例#6
0
 def led_on(self):
     s.write(b'LD2 ON')