https://github.com/novi/i2c-swift-example
Use I2C bus device with Swift
https://github.com/novi/i2c-swift-example
i2c linux swift
Last synced: 11 months ago
JSON representation
Use I2C bus device with Swift
- Host: GitHub
- URL: https://github.com/novi/i2c-swift-example
- Owner: novi
- License: mit
- Created: 2016-12-14T06:27:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-01T12:28:36.000Z (over 9 years ago)
- Last Synced: 2025-04-15T15:13:11.971Z (about 1 year ago)
- Topics: i2c, linux, swift
- Language: Swift
- Homepage:
- Size: 1.3 MB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i2c-swift-example
This repository demonstrates how to control I2C devie with Swift. The library page is [here](https://github.com/novi/i2c-swift).
* `Sources/I2CDetect`: Detect I2C Device on the bus
* `Sources/I2CDeviceModule`: Some I2C module driver library, LED and sensors...
* `Sources/Counter`: Counter demo for LED 8Seg module (ZT.SEG8B4A036A)
* `Sources/LightSens`: Ambient Light Sensor demo (BH1750)
* `Sources/LightSensDisplay`: Combine with LED and light sensor the above
* `Sources/AirPressureSens`: Air Pressure Sensor demo (BMP180)
* `Sources/AirPressureSensDisplay`: Combine with LED and air pressure sensor
* `Sources/HumiditySens`: Humidity Sensor demo (SHT21)
## Supported Platform
* [I2CTinyUSB](https://github.com/novi/i2c_tiny_usb) adapter (Mac)
* I2C Kernel device (/dev/i2c-*) (Linux, Raspberry Pi etc...)
## Building
Install libusb package.
### macOS
```
$ brew install libusb-compat libusb
```
### Linux(Ubuntu 16.04)
```
$ sudo apt-get install i2c-tools libi2c-dev
```
Build library and its demo.
```
make debug
```
On Linux, you should probably run the demo with `sudo`.
```
sudo .build/debug/I2CDetect
```
