Closed kd1889 closed 3 years ago
Added the function
toggle_display(state)
to turn on and off the LCD Screen, based on the given state, 1 and 0, respectively. Test results are shown below:
>>> import radio
>>> radio.toggle_display(0)
Screen is Off
>>> radio.toggle_display(1)
Screen is On
Added function is_len_on in commit 4884b7ed6020004a4948dc917573b285b9c3270e Test available in commit
Added function is_button_pressed and tested in fe1490376dc5a3cc7a163ef5cee45d49cb7be0e9
Preview of test:
Installed /usr/local/lib/python3.8/dist-packages/radio-1.0-py3.8.egg
Processing dependencies for radio==1.0
Finished processing dependencies for radio==1.0
sboahen@SKABB:~/code/Internet-Radio-for-Kids$ python3
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import radio
>>> radio.is_button_pressed(9)
True
Added the function:
send_data_to_screen(text)
The test results are shown below:
>>> import radio
>>> text = "Quick brown fox jumps over the lazy dog"
>>> radio.send_data_to_screen(text)
The following has been sent to the screen: Quick brown fox jumps over the lazy dog
Added the function:
play_sound(sound_file)
The test results are shown below:
>>> import radio
>>> sound_file = "'Hello' By Lionel Richie"
>>> radio.play_sound(sound_file)
Now playing: 'Hello' By Lionel Richie
Added demo.py
to run all functions.
The results:
pi@raspberrypi:~/Internet-Radio-for-Kids $ python3 demo.py
Testing is_led_on
True
Testing is_button_pressed
True
Testing toggle_display with both possible inputs
Screen is Off
Screen is On
Testing send_data_to_screen
The following has been sent to the screen: My name is Kunj
Testing play_sound
Now playing: 'Hello' by Lionel Richie
Create stub functions