全文搜索结果:
- 无线乒乓球 @microbit:趣味程序:micropython
- ts = 0 b_points = 0 winning_score = 5 game_over = False def move_ball(): global ball_x, ball_y, x_di... its else: play(POWER_UP, wait=False) # A gets point if B missed ball ... ts else: play(JUMP_DOWN, wait=False) # player B gets point if A misses ... True if a_points > b_points: play(NYAN, wait=False) display.scroll('A wins!') else: play(FUN
- mpl115a1驱动 @microbit:micropython:驱动库
- 0): self.cs = cs self._spi_enable(False) spi.init(baudrate=baudrate, mode=mode, s... def _spi_disable(self): self._spi_enable(False) def _convert_data(self, lsb, msb): ... to(self.CMD_COEFS, data) self._spi_enable(False) self.a0 = self._convert_data(data[3], da... pi.write(self.CMD_START) self._spi_enable(False) sleep(3) data = bytearray(len(se
- 用arduino模拟ne5555 @创意diy
- intln(tres); if (trig>=5/3){//comparator1 comp2=false; } else{ comp2=true; } if (tres>=10/3){//comparator2 comp1=true; } else{ comp1=false; } if (comp1==true && comp2==false){//flip flop digitalWrite(npn,HIGH); digitalWrite(out,LOW); } if (comp1==false && comp2==true){ digitalWrite(npn,LOW); digitalWr
- 触摸传感 @micropython:开发板:rpipico:demo
- calibT1() print("TrigLevel: ", trigLevel) actT1= False while True: lastT1= actT1 t1Val= getT1()... els detected led.value(1) elif actT1==False and lastT1==False: led.value(0) print(trigLevel,t1Val) # use with plotter of thonny slee
- 温湿度计 @circuitpython:开发板:clue:demo
- true to enable audible alarm tone. alarm_enable = False clue_display = clue.simple_text_display(text_sca... lay[1].text = "Humidity" while True: alarm = False temperature = clue.temperature humidity
- microbit电子音乐 @microbit:趣味程序:micropython
- c = 131 e = 165 g = 196 duration = 150 started = False while True: if button_a.was_pressed(): ... if button_b.was_pressed(): started = False </code> 来自:[[http://www.suppertime.co.uk/blogmyw
- stts751温度传感器 @micropython:mpy-lib:sensor
- self.rb = bytearray(1) self.oneshot = False self.oneshot_mode(False) def int16(self, d): return d if d < 0x8000 else d - 0x1000
- 2线方式驱动ws2812 @circuitpython:其它
- .NeoPixel(board.D5, 4, brightness=0.1, auto_write=False) # our 2-wire strip def leds_show(): leds.pin.value = False # drop pin low so WS2812 protocol starts correctl
- lps22气压传感器 @micropython:mpy-lib:sensor
- self.rb = bytearray(1) self.oneshot = False self.irq_v = [0, 0] # ODR=1 EN_LP... (LPS22_CTRL_REG1, 0x1A) self.oneshot_mode(False) def oneshot_mode(self, oneshot=None):
- lis2dw12 @micropython:mpy-lib:sensor
- self.rb = bytearray(1) self.oneshot = False self.irq_v = [0, 0, 0] self._powe... self.scale(self._scale) self.oneshot_mode(False) def int16(self, d): return
- 马可波罗寻宝游戏 @microbit:趣味程序:micropython
- music import radio def siren(steps=16, up_only=False): for freq in range(880, 1760, steps): ... ): if self.debounce(): return False else: self.bounce()
- hts221 @micropython:mpy-lib:sensor
- self.rb = bytearray(1) self.oneshot = False self.irq_v = [0, 0] # HTS221 Temp
- lis2mdl @micropython:mpy-lib:sensor
- g(LIS2MDL_CFG_REG_C, 0x10) self.oneshot = False self.irq_v = [0, 0, 0] def int16(sel