' ' Controls test (expansion board with four buttons) ' Slightly modified by RJA to show result of pin state over serial terminal CON oscmode = $010c3f04 freq = 160_000_000 CON basepin=0 obj ser: "spin\SmartSerial" pins: "Pins.spin2" pub main | i' clkset(oscmode, freq) ser.start(63, 62, 0, 230_400) waitcnt(cnt+clkfreq*5) ser.str(string("Controls demo", 13, 10)) 'Turn on all the blue leds pins.High(basepin + 0) pins.High(basepin + 1) pins.High(basepin + 2) pins.High(basepin + 3) repeat ' Set buttons low before reading them pins.Low(basepin + 4) pins.Low(basepin + 5) pins.Low(basepin + 6) pins.Low(basepin + 7) waitcnt(cnt+clkfreq/100) pins.In(basepin + 4) pins.In(basepin + 5) pins.In(basepin + 6) pins.In(basepin + 7) 'show results ser.str(string(13,"Button States: ")) ser.bin(ina>>4,4) waitcnt(cnt+clkfreq/10)