VMAC PiHat v2 LED Test

The HAMKit VMAC PiHat includes four on-board LEDs, to facilitate testing and use:

  • Green : 3v3 Supply
  • Blue : Status on GPIO 22
  • Amber : User or RTS on GPIO 17
  • Red : PTT on GPIO 27

All of our sample and test code is developed in Python.

# HAMKit VMAC PiHat v2.4 - LED Test - Dave Williams
# Initialise three LEDs to flash
# Green = 3v3 Supply Healthy
# Blue = Status - GPIO 22
# Amber = User / RTS - GPIO 17
# Red = PTT - GPIO 27
#!/usr/bin/python
# Dave Williams G8PUO, July 2018

#!/usr/bin/python

import RPi.GPIO as GPIO
import time

#====== GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.cleanup()

#Define GPIO Outputs
LEDStatus = 22
LEDUser = 17 # also defined as RTS
LEDPTT = 27


#Setup Outputs
GPIO.setup(LEDStatus,GPIO.OUT)
GPIO.setup(LEDUser,GPIO.OUT)
GPIO.setup(LEDPTT,GPIO.OUT)

#Initiate LEDs
GPIO.output(LEDStatus,GPIO.HIGH)
GPIO.output(LEDUser,GPIO.HIGH)
GPIO.output(LEDPTT,GPIO.HIGH)
time.sleep(1)
GPIO.output(LEDStatus,GPIO.LOW)
GPIO.output(LEDUser,GPIO.LOW)
GPIO.output(LEDPTT,GPIO.LOW)
time.sleep(1)

print ("Flash and Cycle LEDS")

#Loop
while True:
    
    GPIO.output(LEDStatus,GPIO.LOW)
    GPIO.output(LEDUser,GPIO.LOW)
    GPIO.output(LEDPTT,GPIO.LOW)
    time.sleep(1)
    GPIO.output(LEDStatus,GPIO.HIGH)
    time.sleep(1)
    GPIO.output(LEDStatus,GPIO.LOW)
    GPIO.output(LEDUser,GPIO.HIGH)
    time.sleep(1)
    GPIO.output(LEDUser,GPIO.LOW)
    GPIO.output(LEDPTT,GPIO.HIGH)
    time.sleep(1)
    GPIO.output(LEDPTT,GPIO.LOW)
    time.sleep(1)
    GPIO.output(LEDStatus,GPIO.HIGH)
    GPIO.output(LEDUser,GPIO.HIGH)
    GPIO.output(LEDPTT,GPIO.HIGH)
    time.sleep(1)
        

Further details on the configuration and test code can be found in other Wiki pages.  Also see programming and developing in Python.


Please feel free to share our product love through the below