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
#!/usr/bin/env python | |
import requests | |
headers = {'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'} | |
def get_stock(product): | |
r = requests.get("https://www.newegg.com/product/api/ProductRealtime?ItemNumber={}&RecommendItem=&BestSellerItemList=&IsVATPrice=true".format(product), headers=headers) | |
if (r.status_code != 200): | |
return None |
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
void read_receiver_rssi(void) | |
{ | |
if (g.rssi_pin == -1) { | |
receiver_rssi = map(g.rc_6.control_in, 800, 2200, 0, 255); | |
} else { | |
rssi_analog_source->set_pin(g.rssi_pin); | |
float ret = rssi_analog_source->voltage_average() * 50; | |
receiver_rssi = constrain_int16(ret, 0, 255); | |
} | |
} |