This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
hardware:raspberry_pi [2021/03/31 02:53] nanodano ↷ Page moved from hardware:single_board_computers:raspberry_pi to hardware:raspberry_pi |
hardware:raspberry_pi [2021/03/31 17:40] (current) nanodano |
||
---|---|---|---|
Line 86: | Line 86: | ||
</ | </ | ||
- | ===== Configure static IP address for eth0 ===== | + | ===== Networking ===== |
+ | |||
+ | ==== Configure static IP address for eth0 ==== | ||
It should use DHCP by default, but if you want to specify an IP Address you can. | It should use DHCP by default, but if you want to specify an IP Address you can. | ||
Line 99: | Line 101: | ||
</ | </ | ||
- | ===== Manually configure wpa_supplicant for WiFi ===== | + | ==== Manually configure wpa_supplicant for WiFi ==== |
<code bash> | <code bash> | ||
Line 124: | Line 126: | ||
</ | </ | ||
- | ===== Expose local port via remote server | + | ==== Expose local port via remote server ==== |
You can take a service running locally, and use a remote VPS to be a proxy and allow connectivity from the internet. | You can take a service running locally, and use a remote VPS to be a proxy and allow connectivity from the internet. | ||
Line 312: | Line 314: | ||
- | ==== I2C stuff ==== | + | ===== I2C stuff ===== |
+ | |||
+ | Turn on i2c using '' | ||
+ | |||
+ | Install '' | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt install i2c-tools | ||
+ | dpkg -L i2c-tools | ||
+ | sudo i2cdetect 1 # they' | ||
+ | sudo i2cdump --help | ||
+ | </ | ||
+ | |||
+ | ==== I2C C library ==== | ||
+ | |||
+ | <code c test_i2c.cpp> | ||
+ | /* test_i2c.cpp | ||
+ | * Compile with: | ||
+ | | ||
+ | */ | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | int main() { | ||
+ | |||
+ | /* Provide the i2c address from `sudo i2cdetect` */ | ||
+ | int file_handle = wiringPiI2CSetup(0x60); | ||
+ | |||
+ | int result = wiringPiI2CWrite(file_handle, | ||
+ | if (result == -1) { | ||
+ | std::cout << "Error #" << errno << std:: | ||
+ | } else { | ||
+ | | ||
+ | } | ||
+ | |||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== I2C Python Library ==== | ||
+ | |||
+ | Install the [[https:// | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt-get install python3-smbus | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code python test_i2c.py> | ||
+ | # Reference adapted from: https:// | ||
+ | from smbus import SMBus | ||
+ | |||
+ | DEVICE_ADDRESS = 80 | ||
+ | |||
+ | bus1 = SMBus(1) | ||
+ | data = bus1.read_byte_data(DEVICE_ADDRESS, | ||
+ | print(data) | ||
+ | bus1.close() | ||
+ | |||
+ | with SMBus(1) as bus1: | ||
+ | # Write a byte to device address, offset 0 | ||
+ | data = 45 | ||
+ | bus1.write_byte_data(DEVICE_ADDRESS, | ||
+ | </ | ||
- | i2cdetect | ||