I just received my BBB in the mail and am trying to do some basic (very, very basic) tests. I will be using the BBB to (eventually) run my home brewery, and decided to use it over the RasPi because of bonescript.
Back to my issue: I have an SSR which will be controlled from pin P8_46. For my basic test, all I am trying to do is turn it on. I have tried digitalWrite and analogWrite, but neither seem to work. Currently I have a volt meter hooked up to the pin to test the output, it never changes.
Here is my code:
`
var b = require(“bonescript”),
pin = “P8_46”;
b.pinMode(pin, b.OUTPUT);
b.getPinMode(pin,logger);
b.digitalWrite(pin, 1, logger);
b.digitalRead(pin,logger);
//b.analogWrite(pin, 1);
//b.analogRead(pin,logger);
function logger(x){
console.log(x);
}
`
The output I get is:
null
{ value: 1 }
{ pin: ‘P8_46’,
name: ‘GPIO2_7’,
options:
[ ‘lcd_data1’,
‘gpmc_a1’,
‘pr1_mii0_txen’,
‘ehrpwm2B’,
‘NA’,
‘pr1_pru1_pru_r30_1’,
‘pr1_pru1_pru_r31_1’,
‘gpio2_7’ ],
mux: 0,
slew: ‘fast’,
rx: ‘disabled’,
pullup: ‘disabled’ }
So the digitalRead is showing that the pin is on, but the voltage output of the pin on the meter never changes.
When I use analogWrite, I get the following error:
fs.js:429
return binding.write(fd, buffer, offset, length, position);
^
Error: EEXIST, file already exists
at Object.fs.writeSync (fs.js:429:18)
at Object.fs.writeFileSync (fs.js:764:21)
at load_dt (/usr/lib/node_modules/bonescript/index.js:59:12)
at Object.f.analogWrite (/usr/lib/node_modules/bonescript/index.js:519:37)
at Object. (/var/lib/cloud9/brewbone/index.js:21:3)
at Module._compile (module.js:449:26)
at Object.Module._extensions…js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
Eventually, I would like to use analogWrite to be able to control the output with PWM.
Any help would be greatly appreciated. I am sure I am doing something stupid and basic, but I cannot figure it out.
Thanks,
Josh