Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- from sense_hat import SenseHat
- import nfc
- clf = nfc.ContactlessFrontend('usb')
- from nfc.clf import RemoteTarget
- sense = SenseHat()
- pygame.mixer.init()
- #arrived = input("what bus")
- target = clf.sense(RemoteTarget('106A'), RemoteTarget('106B'), RemoteTarget('212F'))
- tag = nfc.tag.activate(clf, target)
- print(tag)
- tag = str(tag)
- bus1 = "Type2Tag ID=6BE5E061" #5769
- bus2 = "Type2Tag ID=0BD54A62" #5735
- bus3 ="Type2Tag ID=7B080962" #5719
- print(bus1)
- greentext=(0,0,255)
- if tag == bus1:
- pygame.mixer.music.load("b5769.ogg")
- pygame.mixer.music.play()
- message = "Bus 5769 has arrived"
- sense.show_message(message, text_colour=greentext)
- while pygame.mixer.music.get_busy() == True:
- continue
- if tag == bus2:
- pygame.mixer.music.load("b5735.ogg")
- pygame.mixer.music.play()
- sense.show_message("Bus 5735 has arrived")
- greentext=(0,0,255)
- while pygame.mixer.music.get_busy() == True:
- continue
- if tag == bus3:
- pygame.mixer.music.load("b5719.ogg")
- pygame.mixer.music.play()
- sense.show_message("bus 5719 has arrived")
- greentext=(0,0,255)
- while pygame.mixer.music.get_busy() == True:
- continue
- clf.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement