Last active
September 1, 2017 08:32
-
-
Save izzuddin91/ec234f0918c8608545b126f8344b4149 to your computer and use it in GitHub Desktop.
calling currency api and send data through serial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import currencylayer | |
| import serial | |
| import time | |
| exchange_rate = currencylayer.Client(access_key='eae8fe8c3b393cca980cf0252f876d5f') | |
| a = exchange_rate.live_rates_for(currencies=['MYR'], base_currency='USD') | |
| value = a['quotes']['USDMYR'] * 1000 | |
| ser = serial.Serial('/dev/ttyACM0',9600) | |
| # tunggu 5 saat utk make sure ade mase utk connect ngan arduino, kalau x jadi laju sangat , x sempat nk pick up data | |
| time.sleep(5) | |
| s = [0] | |
| ser.write(str(value)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment