Mar-26-2017, 11:39 AM
Hello,
I wrote a programme a while back in C++ whilst at college, i am now trying to re-create it in python.
The project was a musical door bell that used 8 relays to hit bells, i am trying to make this work with a rasberry pi and its GPIO pins.
The structure of the C++ code was a loop that would run twice and would call up one of four labeled 'tunes' at random (the button was pushed and the bells would ring two random tunes of the four written in).
This used the 'goto' command and labels for each tune..... from what i can work out Python doesnt like that or work that way.
What is the easiest way to create the same kind of thing? i have the four tunes written and working, but no idea how to seperate them or to get the program to select at random........ (this is me trying to learn python so be kind)
Any help or direction would be appreciated.
Gill
I wrote a programme a while back in C++ whilst at college, i am now trying to re-create it in python.
The project was a musical door bell that used 8 relays to hit bells, i am trying to make this work with a rasberry pi and its GPIO pins.
The structure of the C++ code was a loop that would run twice and would call up one of four labeled 'tunes' at random (the button was pushed and the bells would ring two random tunes of the four written in).
This used the 'goto' command and labels for each tune..... from what i can work out Python doesnt like that or work that way.
What is the easiest way to create the same kind of thing? i have the four tunes written and working, but no idea how to seperate them or to get the program to select at random........ (this is me trying to learn python so be kind)
Any help or direction would be appreciated.
Gill