A Portable Internet Radio

You can listen to thousands of free radio stations on the internet from one tiny little box.

IntermediateShowcase (no instructions)2 hours3,800
A Portable Internet Radio

Things used in this project

Story

Read more

Schematics

Overview of Our project

This is our project After we wrote the code and connected cables and others.

How we connect our cables?

Connected to 22 and 27.

Code

Step 6

Python
We wrote our code on services,when the OS has boot the service will be work. In etc/init.d we define our services. In this directory we define our services based on kill and start (use nano). Also in our code we use pull_up_down for GPIO. Cause of our circuit got noise and don't work.
import os
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)

while True:
    if GPIO.input(22) == False:
        os.system('sudo killall mplayer')
        os.system('mplayer -playlist http://212.83.138.48:8294/listen.pls?sid=1 &')
        time.sleep(2)
    elif GPIO.input(27) == False:
        os.system('sudo killall mplayer')
        os.system('mplayer -playlist http://198.178.123.2:7274/listen.pls?sid=1 &')
        time.sleep(2)
GPIO.cleanup()

Credits

Zahra Keshavarz

Zahra Keshavarz

1 project • 1 follower
Nafise Shakeri

Nafise Shakeri

1 project • 0 followers
Mahshad Goome

Mahshad Goome

1 project • 0 followers
Ehsan Aerabi

Ehsan Aerabi

18 projects • 60 followers
Researcher on IoT and Embedded Systems
Erfan Saghabashi

Erfan Saghabashi

1 project • 22 followers

Comments