Skip to content

Using CFFI with c_environment #7

@sheepcloner

Description

@sheepcloner

The python lib provided for pcduino with gpio lacks quite a bit. In particular I am interested in in pulseIn function, which is not available. I tried to write my own, but I get strange behavior (this is for HC-SR04 distance sensor).
I see that another issue was closed asking people to use CFFI. It is not clear to me how to use it, so I tried the following and failed with ugly compile errors:

from cffi import FFI
ffi = FFI()
lib = ffi.verify("#include <~/c_enviroment/sample/core.h>")

as you can see I did not get far ( I am sure I am doing something totally wrong). I get this error:

File "/usr/local/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 51, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.ffiplatform.VerificationError: CompileError: command 'gcc' failed with exit status 1

I have also tried:

ffi.verify("#include \"/home/ubuntu/c_enviroment/sample/core.h\"")

This time it will find core.h, but complain that it can not find all the other .h files like Arduino.h that core.h refers too.

I would appreciate your help. Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions