c++ - Accessing wiringPi (GPIO) from java through JNI -
i wanna access pi's gpio through java. yes know there pi4j, need use library called rcswitch-pi (on github), sends 433mhz signals (well believe can more thats need)
the thing is, if use library plain c++, can control powerplugs , signals transferred. once use java via jni gpio pin never triggered. plugged in led check no current created. goes way point of script calls functions
digitalwrite(this->ntransmitterpin, high); delaymicroseconds( this->npulselength); }
but thats it. doesn't "digitalwrite" if not called java.
yes performed sudo privileges that's not problem :-/
also, sort of out of curiousity:
in code says "delaymicroseconds" , variable "npulselength" set 300. means each amplitude set 300ms before next 1 called. simple as:
_ _ | |_| |_
for 1010 or something. anyways 433mhz pulse require each wave 60cm long or in other terms:
2.30947 nanoseconds * speed of light = 69.2361688 centimeters
which mean gpio switch have switch 0 1 , 0 within 2.30 nanoseconds. thats hell of lot less 300 milliseconds 1 state switch isn't it??
just wondering...
calling
if (wiringpisetup () == -1) { printf("nowiringpisetup"); }
did trick. called in native main function not in shared library therefore went through fine gpio pins never accessed...
Comments
Post a Comment