PI_newbee
Posts: 172
Joined: Mon Aug 26, 2013 7:41 pm

Why God whhhyyy :-) --> aREST and GPIO

Thu Dec 08, 2016 4:37 pm

Code: Select all

[code]// Modules
var express = require('express');
var app = express();
var piREST = require('pi-arest')(app);
// Set unique ID
piREST.set_id('p5dgwt');
piREST.set_name('pi_cloud');
// Connect to cloud.aREST.io
piREST.connect();
// Start server
var server = app.listen(3000, function() {
    console.log('Listening on port %d', server.address().port);
});
I have two relays connected to PIN 11 and 12 and the plan is to control one of them over cloud. So i installed android app and all parts for RSP. but funny thing happens when i run the code. Before i explain in detail its important to write that there are other parts hooked up to GPIO. Those other parts are 4x4 keypad and two push buttons and they are working OK until i load JS script with aREST.

When the JS code starts it look like that all the GPIO's are blocked and i get message " channel already in use".
After that i can not access keypad and button.
I added GPIO cleanup function in python keypad and button code and this has solved the problem but this isn't good solution because, relay can be triggered any time and when it does, he will again block the GPIO ports.

Btw. each HW part is on different GPIO pin.
Why do i get such error message when i run JS aREST code how can i "limit" arest to controll just two predefined GPIO pins ( 11 / 12 in my case ) ?

PIN

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why God whhhyyy :-) --> aREST and GPIO

Thu Dec 08, 2016 4:44 pm

I guess that is a question better to put to the makers of pi-arest.
Memory in C++ is a leaky abstraction .

PI_newbee
Posts: 172
Joined: Mon Aug 26, 2013 7:41 pm

Re: Why God whhhyyy :-) --> aREST and GPIO

Thu Dec 08, 2016 9:24 pm

I agree, but i was hoping that someone used this approach to get remote GPIO access.
Tell me, do you know some open source python tutorial/script that i can use to control relay over internet.
Some android app with code / tutorial would also be a plus :-)

PIN
btw. i will start new topic on this theme.

Return to “General discussion”