• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

carloop/carloop-library: Carloop library for the Particle platform

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

carloop/carloop-library

开源软件地址(OpenSource Url):

https://github.com/carloop/carloop-library

开源编程语言(OpenSource Language):

C++ 97.6%

开源软件介绍(OpenSource Introduction):

Carloop

Build Status

Make apps for your car using signals from OBD-II, CAN and GPS. Publish data online using the Particle platform.

The hardware and software is all open source!

Don't have one yet? Buy a Carloop here

Have questions? Ask the Carloop community.

Want to learn about Car Hacking? Read this book

Usage

#include "carloop/carloop.h"
Carloop<CarloopRevision2> carloop;

void setup()
{
    carloop.begin();
}

void loop()
{
    carloop.update();
    CANMessage message;
    if(carloop.can().receive(message)) {
        // Do awesome things with message!
    }
}

See complete examples in the examples directory.

Getting started

Follow these instructions on the community to create your first application using the Carloop library.

Learn about programming with the Particle platform at https://docs.particle.io

If you want to add a GPS, get the Carloop Pro

Documentation

Carloop object

Create a global Carloop object and specify the hardware revision (CarloopRevision2). Find this information on the Carloop circuit board (R2.1 means revision 2).

Call begin() in setup() and update() in loop().

Carloop<CarloopRevision2> carloop;

void setup() {
  carloop.begin();
}

void loop() {
  carloop.update();
}

can()

Read and write raw CAN messages.

void setup() {
    carloop.begin();
    Serial.begin(9600);
}

void loop() {
    carloop.update();
    CANMessage message;
    while(carloop.can().receive(message))
    {
        Serial.printf("ID %03x len %d", message.id, message.length);
        for(int i = 0; i < message.length; i++) {
            Serial.printf("%02x ", message.data[i]);
        }
        Serial.print("\n");
    }
}

See the documentation for the Particle CAN driver for more options.

gps()

If you have a GPS connected to the Carloop, you access GPS function through the TinyGPS object with carloop.gps(). To ensure that the GPS location doesn't update in the middle of reading it, surround the block where you extract the GPS data in a WITH_LOCK block.

WITH_LOCK(carloop.gps()) {
  float lat = carloop.gps().location.lat();
  float lng = carloop.gps().location.lng();
  bool gpsValid = carloop.gps().location.isValid();
}

See the TinyGPS library for detailed examples.

battery()

The voltage of the car battery. Make sure you call carloop.update() in the loop() function to update the battery voltage.

float battVoltage = carloop.battery();

TODO

  • OBD PID decoder. carloop["engine_speed"] to get engine speed.
  • OBD fault code reader.

License

Copyright 2016-2017 1000 Tools, Inc. Distributed under the MIT license. See LICENSE for details.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
m5stack/M5Stack: M5Stack Arduino Library发布时间:2022-08-15
下一篇:
h5p/h5p-editor-php-library发布时间:2022-08-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap