RE: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Shabaz Yousaf
Hi Ken,

I can understand, that makes sense.
Also, that’s quite a variety of interesting machines.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: KenUnix<mailto:ken.unix@gmail.com>
Sent: 09 April 2020 01:10
To: BeagleBoard<mailto:beagleboard@googlegroups.com>
Subject: Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

shabaz,

To be honest during my working carrier I only used 'C', Basic, Fortran, Cobol 
and bash.

At this point in my life I don't really want to learn something new like Perl 
or Python unless
I have to.  My eyes are not what they used to be. Also, if you write in pure 
'C' isn't it more
portable without the need for libraries which some day may not be there. 
Perhaps some
day I will try and learn Python.

Hardware I worked on was DEC PDP-11/70's, Tandem Non-Stop, Motorola Unix on
Mc68010 machines, HP 9000 servers and various versions of Linux, Ubuntu, Debian,
Linux Mint LMDE4 and Linux Light..

I have gotten to the point of making portable scripts to install all the 
required software
on my Linux platforms which I run under Oracle VirtualBox. They install the 
usual
applications, development tools and local code. They are written in bash.

My memory is "swelled" with all this stuff.

Ken

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
beagleboard+unsubscr...@googlegroups.com<mailto:beagleboard+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/df86dcb2-44b4-469d-a5bf-4d0f4e00453c%40googlegroups.com<https://groups.google.com/d/msgid/beagleboard/df86dcb2-44b4-469d-a5bf-4d0f4e00453c%40googlegroups.com?utm_medium=email_source=footer>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/DB6P18901MB0214E0FBA959785F22E1678684C10%40DB6P18901MB0214.EURP189.PROD.OUTLOOK.COM.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread KenUnix
shabaz,

To be honest during my working carrier I only used 'C', Basic, Fortran, 
Cobol and bash.

At this point in my life I don't really want to learn something new like 
Perl or Python unless
I have to.  My eyes are not what they used to be. Also, if you write in 
pure 'C' isn't it more
portable without the need for libraries which some day may not be there. 
Perhaps some
day I will try and learn Python.

Hardware I worked on was DEC PDP-11/70's, Tandem Non-Stop, Motorola Unix on
Mc68010 machines, HP 9000 servers and various versions of Linux, Ubuntu, 
Debian,
Linux Mint LMDE4 and Linux Light..

I have gotten to the point of making portable scripts to install all the 
required software
on my Linux platforms which I run under Oracle VirtualBox. They install the 
usual
applications, development tools and local code. They are written in bash. 

My memory is "swelled" with all this stuff.

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/df86dcb2-44b4-469d-a5bf-4d0f4e00453c%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Shabaz Yousaf
Hi Ken,

That code looks like it would work. If you want to have command line arguments, 
the
int main(void)
gets replaced by something like:
int main(int argc, char** argv)
and then you can inspect the argc value to see the number of arguments, and the 
text for each argument will be pointed to by the array of pointers argv.
However, personally I find that once you start wanting more than the most basic 
command line, then it's sometimes better to bite the bullet and use a command 
line library, rather than manually try to read and parse the arguments.
An easy-to-use one is called argp. Others may have different favorites.
I'm curious what the reason is to use C though, if the bash script works. 
Python is preferable to C sometimes too.
Depending on how much lily-guilding is needed, another feature could be some 
mapping between friendly names and GPIO names, in (say) a JSON file.
So, then the command to switch on one relay could be: relay mylamp 1
That's incidentally easier in Python, because it's easy to read config files 
and write them, and so on. But if you've already got working code, it can be 
better to use that sometimes too.






From: beagleboard@googlegroups.com  on behalf of 
KenUnix 
Sent: 09 April 2020 00:32
To: BeagleBoard 
Subject: Re: [beagleboard] Re: 4 Relay relay Cape 'c' code


Snabaz,

If I want to simply control a relay 1. Tthis simple 'c' would work

--Start Code--
#include 
#include 
#include 
#include 

int main()
{
int fd = open( "/sys/class/gpio/gpio20/value", O_RDWR | O_CLOEXEC );  // 
Relay 1
if( fd < 0 ) {
fprintf( stderr, "open: %m\n" );
exit(1);
}

char c = '0'; // 0 = off, 1 == on
write( fd, , 1 );
close( fd );

return 0;
}
--End Code--

Being away from 'c' for some time I would like to add 2
command line arguments. Example  command 1 20
where as  command 1 30  would fail.
1. 0 or 1 for on or off
2. gpio # 20, 7,112 and 115. And validate input was 20, 7, 112 or 115.

If you want more control on, off, state, label this bash script will do it

--Start Code--
#!/bin/bash
#
# 4-7-2020 Ken
#
# cmd [state|label|on|off|in|out] gpio #
# Example : cmd state 112
#
if [ "$1" == "--help" ]
   then
echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
echo "state  Get state of gpio number"
echo "label  Display associated P number"
echo "on Set relay # to on"
echo "offTurn relay off"
echo -e "outSet gpio to out\n"
echo "Example: cmd status 115 Will display the state of gpio 115"
echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
exit
fi

case $2 in
20|7|112|115) ;;
*) echo "Invalid gpio $2"
   echo "Vaild numbers are 20, 7, 112 or 115"
   echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
   exit 1 ;;
esac

case $1 in
   "state")
  direction=`cat /sys/class/gpio/gpio$2/direction`
  echo -n "Direction $direction, State "
  state=`cat /sys/class/gpio/gpio$2/value`
  if [ "$state" == "0" ]; then echo "off"; fi
  if [ "$state" == "1" ]; then echo "on"; fi
  exit ;;
   "label")
  echo -n "Physical header pin number "
  cat /sys/class/gpio/gpio$2/label ;
  exit ;;
   "on")
  echo 1 >/sys/class/gpio/gpio$2/value
  exit ;;
   "off")
  echo 0 >/sys/class/gpio/gpio$2/value
  exit ;;
   "out")
  echo "out" > /sys/class/gpio/gpio$2/direction ;
  exit ;;
   "in")
  echo "in" > /sys/class/gpio/gpio$2/direction ;
  exit ;;
   *) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
esac
--End Code--

Feel free to use the bash script. If you down load it don't forget
to  chmod 755 filename  that way you can execute by  ./filename

Ken


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
beagleboard+unsubscr...@googlegroups.com<mailto:beagleboard+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/4e171c14-b291-4954-a482-acb8cc4042c0%40googlegroups.com<https://groups.google.com/d/msgid/beagleboard/4e171c14-b291-4954-a482-acb8cc4042c0%40googlegroups.com?utm_medium=email_source=footer>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/DB6P18901MB0214A34684727E0BCC6B483384C00%40DB6P18901MB0214.EURP189.PROD.OUTLOOK.COM.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread KenUnix

Snabaz,

If I want to simply control a relay 1. Tthis simple 'c' would work

--Start Code--
#include 
#include 
#include 
#include 

int main()
{
int fd = open( "/sys/class/gpio/gpio20/value", O_RDWR | O_CLOEXEC );  
// Relay 1
if( fd < 0 ) {
fprintf( stderr, "open: %m\n" );
exit(1);
}

char c = '0'; // 0 = off, 1 == on
write( fd, , 1 );
close( fd );

return 0;
}
--End Code--

Being away from 'c' for some time I would like to add 2
command line arguments. Example  command 1 20
where as  command 1 30  would fail.
1. 0 or 1 for on or off
2. gpio # 20, 7,112 and 115. And validate input was 20, 7, 112 or 115.

If you want more control on, off, state, label this bash script will do it

--Start Code--
#!/bin/bash
#
# 4-7-2020 Ken
#
# cmd [state|label|on|off|in|out] gpio #
# Example : cmd state 112
#
if [ "$1" == "--help" ]
   then
echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
echo "state  Get state of gpio number"
echo "label  Display associated P number"
echo "on Set relay # to on"
echo "offTurn relay off"
echo -e "outSet gpio to out\n"
echo "Example: cmd status 115 Will display the state of gpio 115"
echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
exit
fi

case $2 in
20|7|112|115) ;;
*) echo "Invalid gpio $2"
   echo "Vaild numbers are 20, 7, 112 or 115"
   echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
   exit 1 ;;
esac

case $1 in
   "state")
  direction=`cat /sys/class/gpio/gpio$2/direction`
  echo -n "Direction $direction, State "
  state=`cat /sys/class/gpio/gpio$2/value`
  if [ "$state" == "0" ]; then echo "off"; fi
  if [ "$state" == "1" ]; then echo "on"; fi
  exit ;;
   "label")
  echo -n "Physical header pin number "
  cat /sys/class/gpio/gpio$2/label ;
  exit ;;
   "on")
  echo 1 >/sys/class/gpio/gpio$2/value
  exit ;;
   "off")
  echo 0 >/sys/class/gpio/gpio$2/value
  exit ;;
   "out")
  echo "out" > /sys/class/gpio/gpio$2/direction ;
  exit ;;
   "in")
  echo "in" > /sys/class/gpio/gpio$2/direction ;
  exit ;;
   *) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
esac
--End Code--

Feel free to use the bash script. If you down load it don't forget
to  chmod 755 filename  that way you can execute by  ./filename

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/4e171c14-b291-4954-a482-acb8cc4042c0%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Shabaz Yousaf
Hi Seth,

Exactly that, it's just an option to consider or rule out, for this or a future 
project.
It's pretty open, only limits liability. It can be used in commercial or open 
source projects, and can be distributed in binary or source form, provided the 
text below is placed somewhere.
As far as I know, it was used in a product, and it was used for an academic 
paper:


Copyright (c) 2015, Shabaz, VegetableAvenger
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
* Neither the name of BBBIOlib, iobb, libiobb nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.





From: beagleboard@googlegroups.com  on behalf of 
Mala Dies 
Sent: 09 April 2020 00:03
To: BeagleBoard 
Subject: Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

Hey Sir,

Yep. I will test out this C source soon. I guess you are right. It boils down 
to what I want. I mean, if you wanted it and I did not, I guess I would be 
wasting my time using it. W/ that typed out, I would like to use your library.

...

Should I put where I got the library in my source if used?

Seth

P.S. For instance, should I reference each of your names from the github page 
or can I just put https://github.com/shabaz123/iobb in the source?

On Wednesday, April 8, 2020 at 5:54:46 PM UTC-5, shabaz wrote:
The Derek Molloy code (at least from the link below from Seth) uses Linux 
system 'sysfs' to perform the low-level GPIO, so it is far slower than the 
method I ended up using (which directly maps and modifies the registers).  
Despite it not being a microcontroller, I still sometimes want that high speed. 
For instance, I used my library to make an FPGA programmer with the BBB. It 
runs fast. Also, I already had a BBB book - didn't really fancy buying another 
book, I don't see the point when I can write a simple-to-use GPIO library and 
document it as well as a book might.

It depends on what's wanted. I prefer (naturally, otherwise I would not have 
written it : ) my method, primarily for the high speed and Arduino-like 
simplicity. The disadvantages of this method are that it's not as portable (as 
evidenced by the time taken to port to BB-AI : ( - due to having to go down to 
register level, so it is restricted to BBB and PocketBeagle so far.  Another 
disadvantage is that the code is poor, it deserves a re-write from scratch. I'd 
hoped someone would have written a better library over the years so it would 
not be needed, but fast-forward five years, in 2019 I still couldn't find a 
usable fast library, so (for my purposes) I had to ressurect it and re-test it 
- because of non-backward-compatible changes in the BBB Linux image that had 
occurred over the years.

Having said all that, if all that is needed is to control relays, today I'd 
also consider to do it with Python, because that's fast enough. No point using 
a fast library unless you plan to use it for future things that may need the 
higher speed.
Also, nothing wrong perhaps with doing it in a bash script, it's just not 
something I prefer (I'm not super-familiar with shell scripts, so I do the bare 
minimum in such scripts).

For the past few years I've also used the Pi (with the wiringPi C library, 
which is also fast and Arduino-like). I built my own relay board for it. I 
wrote code for it in C (usable with Python of course) to be able to control 
relays from Python or from bash scripts etc.

The only suggestions I have based on that experience, is if you're going to 
switch multiple relays on or off simultaneously, then it's 'friendlier' 
electrically to have a few millisecond pause between each. I ended up 
incorporating that in my code, i.e. for simultaneous contro

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Mala Dies
Hey Sir,

Yep. I will test out this C source soon. I guess you are right. It boils 
down to what I want. I mean, if you wanted it and I did not, I guess I 
would be wasting my time using it. W/ that typed out, I would like to use 
your library.

...

Should I put where I got the library in my source if used? 

Seth

P.S. For instance, should I reference each of your names from the github 
page or can I just put https://github.com/shabaz123/iobb in the source?

On Wednesday, April 8, 2020 at 5:54:46 PM UTC-5, shabaz wrote:
>
> The Derek Molloy code (at least from the link below from Seth) uses Linux 
> system 'sysfs' to perform the low-level GPIO, so it is far slower than the 
> method I ended up using (which directly maps and modifies the registers).  
> Despite it not being a microcontroller, I still sometimes want that high 
> speed. For instance, I used my library to make an FPGA programmer with the 
> BBB. It runs fast. Also, I already had a BBB book - didn't really fancy 
> buying another book, I don't see the point when I can write a simple-to-use 
> GPIO library and document it as well as a book might.
>
> It depends on what's wanted. I prefer (naturally, otherwise I would not 
> have written it : ) my method, primarily for the high speed and 
> Arduino-like simplicity. The disadvantages of this method are that it's not 
> as portable (as evidenced by the time taken to port to BB-AI : ( - due to 
> having to go down to register level, so it is restricted to BBB and 
> PocketBeagle so far.  Another disadvantage is that the code is poor, it 
> deserves a re-write from scratch. I'd hoped someone would have written a 
> better library over the years so it would not be needed, but fast-forward 
> five years, in 2019 I *still *couldn't find a usable fast library, so 
> (for my purposes) I had to ressurect it and re-test it - because of 
> non-backward-compatible changes in the BBB Linux image that had occurred 
> over the years.
>
> Having said all that, if all that is needed is to control relays, today 
> I'd also consider to do it with Python, because that's fast enough. No 
> point using a fast library unless you plan to use it for future things that 
> may need the higher speed.
> Also, nothing wrong perhaps with doing it in a bash script, it's just not 
> something I prefer (I'm not super-familiar with shell scripts, so I do the 
> bare minimum in such scripts).
>
> For the past few years I've also used the Pi (with the wiringPi C library, 
> which is also fast and Arduino-like). I built my own relay board for it. I 
> wrote code for it in C (usable with Python of course) to be able to control 
> relays from Python or from bash scripts etc.
>
> The only suggestions I have based on that experience, is if you're going 
> to switch multiple relays on or off simultaneously, then it's 'friendlier' 
> electrically to have a few millisecond pause between each. I ended up 
> incorporating that in my code, i.e. for simultaneous control it would 
> automatically stagger by a few milliseconds multiple relays switching on to 
> make it just a perceived simultaneous time.
>
>
>
> ----------
> *From:* beagl...@googlegroups.com   > on behalf of jonnymo >
> *Sent:* 08 April 2020 23:00
> *To:* Beagle Board >
> *Subject:* Re: [beagleboard] Re: 4 Relay relay Cape 'c' code 
>  
> Mala, 
>
> Yeah, I have 3 variations of Molloy's books and I do find them quite 
> nice.  His code more up to date than the shabaz code, so I would prefer 
> that.
>
> The other option is the AdaFruit BBIO Python code, which I believe Molloy 
> uses.
>
> https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation-on-ubuntu
>  
>
> Regardless, its best to just understand how the underline system is 
> working and how to make calls to the GPIO pins and then go your own route.
>
>
> Jon 
>
> On Wed, Apr 8, 2020 at 2:42 PM Mala Dies > 
> wrote:
>
> Hello jonnymo, 
>
> Seth here. The book exploringBB has some nice source for C++ workings w/ 
> it geared to, on Chapter 6, GPIO and other peripherals. 
>
> Seth
>
> P.S. See here: 
> https://github.com/derekmolloy/exploringBB/tree/version2/chp06. Although 
> this was from two years ago, I am sure if we work on it, minor improvements 
> or some similar changes might be all that is needed. Who knows?
>
> On Tuesday, April 7, 2020 at 5:28:31 PM UTC-5, jonnymo wrote: 
>
> Is this what you are referring to? 
>
>
> http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/
>  
>
>  https://github.com/derekmolloy/exploringBB
>
> Jon
>
> On Tue, Apr 7, 2020 at 3:20 PM Mala Dies  wrote:
>
> Hello KenUnix, 
>
> Seth he

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Shabaz Yousaf
The Derek Molloy code (at least from the link below from Seth) uses Linux 
system 'sysfs' to perform the low-level GPIO, so it is far slower than the 
method I ended up using (which directly maps and modifies the registers).  
Despite it not being a microcontroller, I still sometimes want that high speed. 
For instance, I used my library to make an FPGA programmer with the BBB. It 
runs fast. Also, I already had a BBB book - didn't really fancy buying another 
book, I don't see the point when I can write a simple-to-use GPIO library and 
document it as well as a book might.

It depends on what's wanted. I prefer (naturally, otherwise I would not have 
written it : ) my method, primarily for the high speed and Arduino-like 
simplicity. The disadvantages of this method are that it's not as portable (as 
evidenced by the time taken to port to BB-AI : ( - due to having to go down to 
register level, so it is restricted to BBB and PocketBeagle so far.  Another 
disadvantage is that the code is poor, it deserves a re-write from scratch. I'd 
hoped someone would have written a better library over the years so it would 
not be needed, but fast-forward five years, in 2019 I still couldn't find a 
usable fast library, so (for my purposes) I had to ressurect it and re-test it 
- because of non-backward-compatible changes in the BBB Linux image that had 
occurred over the years.

Having said all that, if all that is needed is to control relays, today I'd 
also consider to do it with Python, because that's fast enough. No point using 
a fast library unless you plan to use it for future things that may need the 
higher speed.
Also, nothing wrong perhaps with doing it in a bash script, it's just not 
something I prefer (I'm not super-familiar with shell scripts, so I do the bare 
minimum in such scripts).

For the past few years I've also used the Pi (with the wiringPi C library, 
which is also fast and Arduino-like). I built my own relay board for it. I 
wrote code for it in C (usable with Python of course) to be able to control 
relays from Python or from bash scripts etc.

The only suggestions I have based on that experience, is if you're going to 
switch multiple relays on or off simultaneously, then it's 'friendlier' 
electrically to have a few millisecond pause between each. I ended up 
incorporating that in my code, i.e. for simultaneous control it would 
automatically stagger by a few milliseconds multiple relays switching on to 
make it just a perceived simultaneous time.




From: beagleboard@googlegroups.com  on behalf of 
jonnymo 
Sent: 08 April 2020 23:00
To: Beagle Board 
Subject: Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

Mala,

Yeah, I have 3 variations of Molloy's books and I do find them quite nice.  His 
code more up to date than the shabaz code, so I would prefer that.

The other option is the AdaFruit BBIO Python code, which I believe Molloy uses.
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation-on-ubuntu

Regardless, its best to just understand how the underline system is working and 
how to make calls to the GPIO pins and then go your own route.


Jon

On Wed, Apr 8, 2020 at 2:42 PM Mala Dies 
mailto:fun...@gmail.com>> wrote:
Hello jonnymo,

Seth here. The book exploringBB has some nice source for C++ workings w/ it 
geared to, on Chapter 6, GPIO and other peripherals.

Seth

P.S. See here: https://github.com/derekmolloy/exploringBB/tree/version2/chp06. 
Although this was from two years ago, I am sure if we work on it, minor 
improvements or some similar changes might be all that is needed. Who knows?

On Tuesday, April 7, 2020 at 5:28:31 PM UTC-5, jonnymo wrote:
Is this what you are referring to?

http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/

 https://github.com/derekmolloy/exploringBB

Jon

On Tue, Apr 7, 2020 at 3:20 PM Mala Dies  wrote:
Hello KenUnix,

Seth here. Do you want me to still work on the C++ code or are you satisfied w/ 
the shell script you are working on currently?

Seth

P.S. I found my book, ideas, and everything is on chapter six w/ source already 
done for specific ideas. I would probably need to change some source, too. Let 
a brother know.

On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
Robert,

You were correct high level is better for now. It's been a long while since 
working
with 'c'.  Went the way of a bash script. Works well see below. Even supports 
--help.

---Code Start--
#!/bin/bash
#
# 4-7-2020 Ken
#
# cmd [state|label|on|off|in|out] gpio #
# Example : cmd state 112
#
if [ "$1" == "--help" ]
   then
echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
echo "state  Get state of gpio number"
echo "label  Display associated P number"
echo "on Set relay # to on"
echo "offTurn relay off"
echo -e "outSet gpio to out\n&q

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread jonnymo
Mala,

Yeah, I have 3 variations of Molloy's books and I do find them quite nice.
His code more up to date than the shabaz code, so I would prefer that.

The other option is the AdaFruit BBIO Python code, which I believe Molloy
uses.
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation-on-ubuntu


Regardless, its best to just understand how the underline system is working
and how to make calls to the GPIO pins and then go your own route.


Jon

On Wed, Apr 8, 2020 at 2:42 PM Mala Dies  wrote:

> Hello jonnymo,
>
> Seth here. The book exploringBB has some nice source for C++ workings w/
> it geared to, on Chapter 6, GPIO and other peripherals.
>
> Seth
>
> P.S. See here:
> https://github.com/derekmolloy/exploringBB/tree/version2/chp06. Although
> this was from two years ago, I am sure if we work on it, minor improvements
> or some similar changes might be all that is needed. Who knows?
>
> On Tuesday, April 7, 2020 at 5:28:31 PM UTC-5, jonnymo wrote:
>>
>> Is this what you are referring to?
>>
>>
>> http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/
>>
>>
>>  https://github.com/derekmolloy/exploringBB
>>
>> Jon
>>
>> On Tue, Apr 7, 2020 at 3:20 PM Mala Dies  wrote:
>>
>>> Hello KenUnix,
>>>
>>> Seth here. Do you want me to still work on the C++ code or are you
>>> satisfied w/ the shell script you are working on currently?
>>>
>>> Seth
>>>
>>> P.S. I found my book, ideas, and everything is on chapter six w/ source
>>> already done for specific ideas. I would probably need to change some
>>> source, too. Let a brother know.
>>>
>>> On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:

 Robert,

 You were correct high level is better for now. It's been a long while
 since working
 with 'c'.  Went the way of a bash script. Works well see below. Even
 supports --help.

 ---Code Start--
 #!/bin/bash
 #
 # 4-7-2020 Ken
 #
 # cmd [state|label|on|off|in|out] gpio #
 # Example : cmd state 112
 #
 if [ "$1" == "--help" ]
then
 echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
 echo "state  Get state of gpio number"
 echo "label  Display associated P number"
 echo "on Set relay # to on"
 echo "offTurn relay off"
 echo -e "outSet gpio to out\n"
 echo "Example: cmd status 115 Will display the state of gpio 115"
 echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
 exit
 fi

 case $2 in
 20|7|112|115) ;;
 *) echo "Invalid gpio $2"
echo "Vaild numbers are 20, 7, 112 or 115"
echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
exit 1 ;;
 esac

 case $1 in
"state")
   direction=`cat /sys/class/gpio/gpio$2/direction`
   echo -n "Direction $direction, State "
   state=`cat /sys/class/gpio/gpio$2/value`
   if [ "$state" == "0" ]; then echo "off"; fi
   if [ "$state" == "1" ]; then echo "on"; fi
   exit ;;
"label")
   echo -n "Physical header pin number "
   cat /sys/class/gpio/gpio$2/label ;
   exit ;;
"on")
   echo 1 >/sys/class/gpio/gpio$2/value
   exit ;;
"off")
   echo 0 >/sys/class/gpio/gpio$2/value
   exit ;;
"out")
   echo "out" > /sys/class/gpio/gpio$2/direction ;
   exit ;;
"in")
   echo "in" > /sys/class/gpio/gpio$2/direction ;
   exit ;;
*) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
 esac
 --Code End--

 Maybe someone else may find this useful.

 Ken


>>> On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:

 Robert,

 You were correct high level is better for now. It's been a long while
 since working
 with 'c'.  Went the way of a bash script. Works well see below. Even
 supports --help.

 ---Code Start--
 #!/bin/bash
 #
 # 4-7-2020 Ken
 #
 # cmd [state|label|on|off|in|out] gpio #
 # Example : cmd state 112
 #
 if [ "$1" == "--help" ]
then
 echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
 echo "state  Get state of gpio number"
 echo "label  Display associated P number"
 echo "on Set relay # to on"
 echo "offTurn relay off"
 echo -e "outSet gpio to out\n"
 echo "Example: cmd status 115 Will display the state of gpio 115"
 echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
 exit
 fi

 case $2 in
 20|7|112|115) ;;
 *) echo "Invalid gpio $2"
echo "Vaild numbers are 20, 7, 112 or 115"
echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
exit 1 ;;
 esac

 case 

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Mala Dies
Hello,

I am thankful that you updated me yesterday. I am waiting to try out the 
iobb library from shabaz soon. If you test it, let a brother know how it 
works out.

Seth

On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 8:01:17 PM UTC-5, KenUnix wrote:
>
> Jon,
>>
>
> I'll let Seth know.
>
> Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
> 3-26-2020
> And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.
>
> I always like tp glance at code. You never know
> when you will find something interesting. That's
> how it was for me when I first started using Unix
> back in 1974.
>
> Ken
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/80546d94-6020-480f-8bda-503370a8a9f8%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Mala Dies
Hello shabaz,

Seth here. I have been trying to find time to use this library. If it works 
on the new image, I will do my work to make time to use it. 

Seth

P.S. I saw this library a long time ago. I have been staying patient in 
case there were some other people that were to update it. Are you familiar 
w/ MRAA and UPM libraries from Eclipse?

On Tuesday, April 7, 2020 at 7:58:00 PM UTC-5, shabaz wrote:
>
> There's also a semi-Arduino-like C library I partially worked on described 
> here:
>
> https://www.element14.com/community/community/designcenter/single-board-computers/next-genbeaglebone/blog/2019/08/15/beaglebone-black-bbb-io-gpio-spi-and-i2c-library-for-c-2019-edition
> .. that was tested in the latter half of 2019, on BBB and PocketBeagle. 
> Turning a pin on/off in C is like this:
>
> Setup:
> #include   
> iolib_init();  // initialize the library
> iolib_setdir(8, 12, DigitalOut);  // set the pin as an output
>
> And then controlling a pin connected to a relay board or whatever:
>
> pin_high(8, 12);
> pin_low(8,12);
>
> where the '8' represents the connector P8, and the '12' represents pin 12 
> on that connector.
>
> It's not pretty code, it's quite ropey, but it worked in the limited tests 
> I've used it for, and it supports I2C and SPI too. Plus it's fast, toggle 
> speed is > 2MHz.
>
> I started trying to port it to BB-AI, but have put it on pause for now, so 
> many register differences : (
>
>
> --
> *From:* beagl...@googlegroups.com   > on behalf of jonnymo >
> *Sent:* 08 April 2020 01:47
> *To:* Beagle Board >
> *Subject:* Re: [beagleboard] Re: 4 Relay relay Cape 'c' code 
>  
> Ken, 
>
>Sorry I do not have a Relay board, but I have done the shell scripting 
> thing before.
>
> Are you using a BB Black?
>
> I am curious as to what Seth/Mala comes up with though.
>
>
> Cheers,
>
> Jon
>
> On Tue, Apr 7, 2020 at 3:41 PM KenUnix > 
> wrote:
>
>  Jon,
>
>
> Thanks I will look at them.
>
> Did you see that script I uploaded? Give it a try.
>
> Ken
>
> -- 
> For more options, visit http://beagleboard.org/discuss
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to beagl...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beagleboard/31b186a4-a24e-4ff3-99a8-762ba3c7791a%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beagleboard/31b186a4-a24e-4ff3-99a8-762ba3c7791a%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> -- 
> For more options, visit http://beagleboard.org/discuss
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to beagl...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beagleboard/CAG99bkrt_RnDAm%3Drbj3kjs3SEqZXKmeCSXF8AQi9TXDkptERQw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/beagleboard/CAG99bkrt_RnDAm%3Drbj3kjs3SEqZXKmeCSXF8AQi9TXDkptERQw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

On Tuesday, April 7, 2020 at 7:58:00 PM UTC-5, shabaz wrote:
>
> There's also a semi-Arduino-like C library I partially worked on described 
> here:
>
> https://www.element14.com/community/community/designcenter/single-board-computers/next-genbeaglebone/blog/2019/08/15/beaglebone-black-bbb-io-gpio-spi-and-i2c-library-for-c-2019-edition
> .. that was tested in the latter half of 2019, on BBB and PocketBeagle. 
> Turning a pin on/off in C is like this:
>
> Setup:
> #include   
> iolib_init();  // initialize the library
> iolib_setdir(8, 12, DigitalOut);  // set the pin as an output
>
> And then controlling a pin connected to a relay board or whatever:
>
> pin_high(8, 12);
> pin_low(8,12);
>
> where the '8' represents the connector P8, and the '12' represents pin 12 
> on that connector.
>
> It's not pretty code, it's quite ropey, but it worked in the limited tests 
> I've used it for, and it supports I2C and SPI too. Plus it's fast, toggle 
> speed is > 2MHz.
>
> I started trying to port it to BB-AI, but have put it on pause for now, so 
> many register differences : (
>
>
> --
> *From:* beagl...@googlegroups.com   > on behalf of jonnymo >
> *Sent:* 08 April 2020 01:47
> *To:* Beagle Board >
> *Subject:* Re: [beagleboard] Re: 4 Relay relay Cape 'c' code 
>  
> Ken, 
>
>Sorry I do not

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-08 Thread Mala Dies
Hello jonnymo,

Seth here. The book exploringBB has some nice source for C++ workings w/ it 
geared to, on Chapter 6, GPIO and other peripherals. 

Seth

P.S. See 
here: https://github.com/derekmolloy/exploringBB/tree/version2/chp06. 
Although this was from two years ago, I am sure if we work on it, minor 
improvements or some similar changes might be all that is needed. Who knows?

On Tuesday, April 7, 2020 at 5:28:31 PM UTC-5, jonnymo wrote:
>
> Is this what you are referring to?
>
>
> http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/
>  
>
>  https://github.com/derekmolloy/exploringBB
>
> Jon
>
> On Tue, Apr 7, 2020 at 3:20 PM Mala Dies > 
> wrote:
>
>> Hello KenUnix,
>>
>> Seth here. Do you want me to still work on the C++ code or are you 
>> satisfied w/ the shell script you are working on currently?
>>
>> Seth
>>
>> P.S. I found my book, ideas, and everything is on chapter six w/ source 
>> already done for specific ideas. I would probably need to change some 
>> source, too. Let a brother know. 
>>
>> On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
>>>
>>> Robert,
>>>
>>> You were correct high level is better for now. It's been a long while 
>>> since working
>>> with 'c'.  Went the way of a bash script. Works well see below. Even 
>>> supports --help.
>>>
>>> ---Code Start--
>>> #!/bin/bash
>>> #
>>> # 4-7-2020 Ken
>>> #
>>> # cmd [state|label|on|off|in|out] gpio #
>>> # Example : cmd state 112
>>> #
>>> if [ "$1" == "--help" ]
>>>then
>>> echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
>>> echo "state  Get state of gpio number"
>>> echo "label  Display associated P number"
>>> echo "on Set relay # to on"
>>> echo "offTurn relay off"
>>> echo -e "outSet gpio to out\n"
>>> echo "Example: cmd status 115 Will display the state of gpio 115"
>>> echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
>>> exit
>>> fi
>>>
>>> case $2 in
>>> 20|7|112|115) ;;
>>> *) echo "Invalid gpio $2"
>>>echo "Vaild numbers are 20, 7, 112 or 115"
>>>echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
>>>exit 1 ;;
>>> esac
>>>
>>> case $1 in
>>>"state")
>>>   direction=`cat /sys/class/gpio/gpio$2/direction`
>>>   echo -n "Direction $direction, State "
>>>   state=`cat /sys/class/gpio/gpio$2/value`
>>>   if [ "$state" == "0" ]; then echo "off"; fi
>>>   if [ "$state" == "1" ]; then echo "on"; fi
>>>   exit ;;
>>>"label")
>>>   echo -n "Physical header pin number "
>>>   cat /sys/class/gpio/gpio$2/label ;
>>>   exit ;;
>>>"on")
>>>   echo 1 >/sys/class/gpio/gpio$2/value
>>>   exit ;;
>>>"off")
>>>   echo 0 >/sys/class/gpio/gpio$2/value
>>>   exit ;;
>>>"out")
>>>   echo "out" > /sys/class/gpio/gpio$2/direction ;
>>>   exit ;;
>>>"in")
>>>   echo "in" > /sys/class/gpio/gpio$2/direction ;
>>>   exit ;;
>>>*) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
>>> esac
>>> --Code End--
>>>
>>> Maybe someone else may find this useful.
>>>
>>> Ken
>>>
>>>
>> On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
>>>
>>> Robert,
>>>
>>> You were correct high level is better for now. It's been a long while 
>>> since working
>>> with 'c'.  Went the way of a bash script. Works well see below. Even 
>>> supports --help.
>>>
>>> ---Code Start--
>>> #!/bin/bash
>>> #
>>> # 4-7-2020 Ken
>>> #
>>> # cmd [state|label|on|off|in|out] gpio #
>>> # Example : cmd state 112
>>> #
>>> if [ "$1" == "--help" ]
>>>then
>>> echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
>>> echo "state  Get state of gpio number"
>>> echo "label  Display associated P number"
>>> echo "on Set relay # to on"
>>> echo "offTurn relay off"
>>> echo -e "outSet gpio to out\n"
>>> echo "Example: cmd status 115 Will display the state of gpio 115"
>>> echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
>>> exit
>>> fi
>>>
>>> case $2 in
>>> 20|7|112|115) ;;
>>> *) echo "Invalid gpio $2"
>>>echo "Vaild numbers are 20, 7, 112 or 115"
>>>echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
>>>exit 1 ;;
>>> esac
>>>
>>> case $1 in
>>>"state")
>>>   direction=`cat /sys/class/gpio/gpio$2/direction`
>>>   echo -n "Direction $direction, State "
>>>   state=`cat /sys/class/gpio/gpio$2/value`
>>>   if [ "$state" == "0" ]; then echo "off"; fi
>>>   if [ "$state" == "1" ]; then echo "on"; fi
>>>   exit ;;
>>>"label")
>>>   echo -n "Physical header pin number "
>>>   cat /sys/class/gpio/gpio$2/label ;
>>>   exit ;;
>>>"on")
>>>   echo 1 >/sys/class/gpio/gpio$2/value
>>>   exit ;;
>>>"off")
>>>   echo 0 >/sys/class/gpio/gpio$2/value
>>>   exit ;;
>>>"out")
>>>   echo "out" > /sys/class/gpio/gpio$2/direction ;
>>>   

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread KenUnix

>
> Jon,
>

I'll let Seth know.

Regarding me yes I have a BBB with a relay cape running Debian 10.3 IoT 
3-26-2020
And a 4 port usb-2 powered hub and a .Realtek RTL8188EUS USB WiFi adapter.

I always like tp glance at code. You never know
when you will find something interesting. That's
how it was for me when I first started using Unix
back in 1974.

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/bd1a9600-8b5c-4cee-af48-7085575ead67%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread Shabaz Yousaf
There's also a semi-Arduino-like C library I partially worked on described here:
https://www.element14.com/community/community/designcenter/single-board-computers/next-genbeaglebone/blog/2019/08/15/beaglebone-black-bbb-io-gpio-spi-and-i2c-library-for-c-2019-edition
.. that was tested in the latter half of 2019, on BBB and PocketBeagle. Turning 
a pin on/off in C is like this:

Setup:
#include 
iolib_init();  // initialize the library
iolib_setdir(8, 12, DigitalOut);  // set the pin as an output

And then controlling a pin connected to a relay board or whatever:

pin_high(8, 12);
pin_low(8,12);

where the '8' represents the connector P8, and the '12' represents pin 12 on 
that connector.

It's not pretty code, it's quite ropey, but it worked in the limited tests I've 
used it for, and it supports I2C and SPI too. Plus it's fast, toggle speed is > 
2MHz.

I started trying to port it to BB-AI, but have put it on pause for now, so many 
register differences : (



From: beagleboard@googlegroups.com  on behalf of 
jonnymo 
Sent: 08 April 2020 01:47
To: Beagle Board 
Subject: Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

Ken,

   Sorry I do not have a Relay board, but I have done the shell scripting thing 
before.

Are you using a BB Black?

I am curious as to what Seth/Mala comes up with though.


Cheers,

Jon

On Tue, Apr 7, 2020 at 3:41 PM KenUnix 
mailto:ken.unix@gmail.com>> wrote:
 Jon,

Thanks I will look at them.

Did you see that script I uploaded? Give it a try.

Ken


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
beagleboard+unsubscr...@googlegroups.com<mailto:beagleboard+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/31b186a4-a24e-4ff3-99a8-762ba3c7791a%40googlegroups.com<https://groups.google.com/d/msgid/beagleboard/31b186a4-a24e-4ff3-99a8-762ba3c7791a%40googlegroups.com?utm_medium=email_source=footer>.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
beagleboard+unsubscr...@googlegroups.com<mailto:beagleboard+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAG99bkrt_RnDAm%3Drbj3kjs3SEqZXKmeCSXF8AQi9TXDkptERQw%40mail.gmail.com<https://groups.google.com/d/msgid/beagleboard/CAG99bkrt_RnDAm%3Drbj3kjs3SEqZXKmeCSXF8AQi9TXDkptERQw%40mail.gmail.com?utm_medium=email_source=footer>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/DB6P18901MB0214F919F37015C6F99C7C9984C00%40DB6P18901MB0214.EURP189.PROD.OUTLOOK.COM.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread jonnymo
Ken,

   Sorry I do not have a Relay board, but I have done the shell scripting
thing before.

Are you using a BB Black?

I am curious as to what Seth/Mala comes up with though.


Cheers,

Jon

On Tue, Apr 7, 2020 at 3:41 PM KenUnix  wrote:

>  Jon,
>>
>
> Thanks I will look at them.
>
> Did you see that script I uploaded? Give it a try.
>
> Ken
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/31b186a4-a24e-4ff3-99a8-762ba3c7791a%40googlegroups.com
> 
> .
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAG99bkrt_RnDAm%3Drbj3kjs3SEqZXKmeCSXF8AQi9TXDkptERQw%40mail.gmail.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread KenUnix

>
>  Jon,
>

Thanks I will look at them.

Did you see that script I uploaded? Give it a try.

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/31b186a4-a24e-4ff3-99a8-762ba3c7791a%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread KenUnix

>
> Seth,
>

Yes I am still interested. brb.

Try out that script. It's kind of neat. Let me know what you think.

After downloading it to a file chmod 755 filename
It's actually useful  cmd is the name you give the
file. In my case I called it  relay

cmd state 115
cmd on 20
cmd off 20
cmd label 7
cmd out 112
cmd --help

I just finished another script that exercises the relays.

See you on the Kiwi flip side...

KenUnix

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/6c6487c9-d9b5-4828-8bea-5b1ad9f212e0%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread jonnymo
Is this what you are referring to?

http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/


 https://github.com/derekmolloy/exploringBB

Jon

On Tue, Apr 7, 2020 at 3:20 PM Mala Dies  wrote:

> Hello KenUnix,
>
> Seth here. Do you want me to still work on the C++ code or are you
> satisfied w/ the shell script you are working on currently?
>
> Seth
>
> P.S. I found my book, ideas, and everything is on chapter six w/ source
> already done for specific ideas. I would probably need to change some
> source, too. Let a brother know.
>
> On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
>>
>> Robert,
>>
>> You were correct high level is better for now. It's been a long while
>> since working
>> with 'c'.  Went the way of a bash script. Works well see below. Even
>> supports --help.
>>
>> ---Code Start--
>> #!/bin/bash
>> #
>> # 4-7-2020 Ken
>> #
>> # cmd [state|label|on|off|in|out] gpio #
>> # Example : cmd state 112
>> #
>> if [ "$1" == "--help" ]
>>then
>> echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
>> echo "state  Get state of gpio number"
>> echo "label  Display associated P number"
>> echo "on Set relay # to on"
>> echo "offTurn relay off"
>> echo -e "outSet gpio to out\n"
>> echo "Example: cmd status 115 Will display the state of gpio 115"
>> echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
>> exit
>> fi
>>
>> case $2 in
>> 20|7|112|115) ;;
>> *) echo "Invalid gpio $2"
>>echo "Vaild numbers are 20, 7, 112 or 115"
>>echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
>>exit 1 ;;
>> esac
>>
>> case $1 in
>>"state")
>>   direction=`cat /sys/class/gpio/gpio$2/direction`
>>   echo -n "Direction $direction, State "
>>   state=`cat /sys/class/gpio/gpio$2/value`
>>   if [ "$state" == "0" ]; then echo "off"; fi
>>   if [ "$state" == "1" ]; then echo "on"; fi
>>   exit ;;
>>"label")
>>   echo -n "Physical header pin number "
>>   cat /sys/class/gpio/gpio$2/label ;
>>   exit ;;
>>"on")
>>   echo 1 >/sys/class/gpio/gpio$2/value
>>   exit ;;
>>"off")
>>   echo 0 >/sys/class/gpio/gpio$2/value
>>   exit ;;
>>"out")
>>   echo "out" > /sys/class/gpio/gpio$2/direction ;
>>   exit ;;
>>"in")
>>   echo "in" > /sys/class/gpio/gpio$2/direction ;
>>   exit ;;
>>*) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
>> esac
>> --Code End--
>>
>> Maybe someone else may find this useful.
>>
>> Ken
>>
>>
> On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
>>
>> Robert,
>>
>> You were correct high level is better for now. It's been a long while
>> since working
>> with 'c'.  Went the way of a bash script. Works well see below. Even
>> supports --help.
>>
>> ---Code Start--
>> #!/bin/bash
>> #
>> # 4-7-2020 Ken
>> #
>> # cmd [state|label|on|off|in|out] gpio #
>> # Example : cmd state 112
>> #
>> if [ "$1" == "--help" ]
>>then
>> echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
>> echo "state  Get state of gpio number"
>> echo "label  Display associated P number"
>> echo "on Set relay # to on"
>> echo "offTurn relay off"
>> echo -e "outSet gpio to out\n"
>> echo "Example: cmd status 115 Will display the state of gpio 115"
>> echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
>> exit
>> fi
>>
>> case $2 in
>> 20|7|112|115) ;;
>> *) echo "Invalid gpio $2"
>>echo "Vaild numbers are 20, 7, 112 or 115"
>>echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
>>exit 1 ;;
>> esac
>>
>> case $1 in
>>"state")
>>   direction=`cat /sys/class/gpio/gpio$2/direction`
>>   echo -n "Direction $direction, State "
>>   state=`cat /sys/class/gpio/gpio$2/value`
>>   if [ "$state" == "0" ]; then echo "off"; fi
>>   if [ "$state" == "1" ]; then echo "on"; fi
>>   exit ;;
>>"label")
>>   echo -n "Physical header pin number "
>>   cat /sys/class/gpio/gpio$2/label ;
>>   exit ;;
>>"on")
>>   echo 1 >/sys/class/gpio/gpio$2/value
>>   exit ;;
>>"off")
>>   echo 0 >/sys/class/gpio/gpio$2/value
>>   exit ;;
>>"out")
>>   echo "out" > /sys/class/gpio/gpio$2/direction ;
>>   exit ;;
>>"in")
>>   echo "in" > /sys/class/gpio/gpio$2/direction ;
>>   exit ;;
>>*) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
>> esac
>> --Code End--
>>
>> Maybe someone else may find this useful.
>>
>> Ken
>>
>> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> 

Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread Mala Dies
Hello KenUnix,

Seth here. Do you want me to still work on the C++ code or are you 
satisfied w/ the shell script you are working on currently?

Seth

P.S. I found my book, ideas, and everything is on chapter six w/ source 
already done for specific ideas. I would probably need to change some 
source, too. Let a brother know. 

On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
>
> Robert,
>
> You were correct high level is better for now. It's been a long while 
> since working
> with 'c'.  Went the way of a bash script. Works well see below. Even 
> supports --help.
>
> ---Code Start--
> #!/bin/bash
> #
> # 4-7-2020 Ken
> #
> # cmd [state|label|on|off|in|out] gpio #
> # Example : cmd state 112
> #
> if [ "$1" == "--help" ]
>then
> echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
> echo "state  Get state of gpio number"
> echo "label  Display associated P number"
> echo "on Set relay # to on"
> echo "offTurn relay off"
> echo -e "outSet gpio to out\n"
> echo "Example: cmd status 115 Will display the state of gpio 115"
> echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
> exit
> fi
>
> case $2 in
> 20|7|112|115) ;;
> *) echo "Invalid gpio $2"
>echo "Vaild numbers are 20, 7, 112 or 115"
>echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
>exit 1 ;;
> esac
>
> case $1 in
>"state")
>   direction=`cat /sys/class/gpio/gpio$2/direction`
>   echo -n "Direction $direction, State "
>   state=`cat /sys/class/gpio/gpio$2/value`
>   if [ "$state" == "0" ]; then echo "off"; fi
>   if [ "$state" == "1" ]; then echo "on"; fi
>   exit ;;
>"label")
>   echo -n "Physical header pin number "
>   cat /sys/class/gpio/gpio$2/label ;
>   exit ;;
>"on")
>   echo 1 >/sys/class/gpio/gpio$2/value
>   exit ;;
>"off")
>   echo 0 >/sys/class/gpio/gpio$2/value
>   exit ;;
>"out")
>   echo "out" > /sys/class/gpio/gpio$2/direction ;
>   exit ;;
>"in")
>   echo "in" > /sys/class/gpio/gpio$2/direction ;
>   exit ;;
>*) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
> esac
> --Code End--
>
> Maybe someone else may find this useful.
>
> Ken
>
>
On Tuesday, April 7, 2020 at 11:39:56 AM UTC-5, KenUnix wrote:
>
> Robert,
>
> You were correct high level is better for now. It's been a long while 
> since working
> with 'c'.  Went the way of a bash script. Works well see below. Even 
> supports --help.
>
> ---Code Start--
> #!/bin/bash
> #
> # 4-7-2020 Ken
> #
> # cmd [state|label|on|off|in|out] gpio #
> # Example : cmd state 112
> #
> if [ "$1" == "--help" ]
>then
> echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
> echo "state  Get state of gpio number"
> echo "label  Display associated P number"
> echo "on Set relay # to on"
> echo "offTurn relay off"
> echo -e "outSet gpio to out\n"
> echo "Example: cmd status 115 Will display the state of gpio 115"
> echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
> exit
> fi
>
> case $2 in
> 20|7|112|115) ;;
> *) echo "Invalid gpio $2"
>echo "Vaild numbers are 20, 7, 112 or 115"
>echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
>exit 1 ;;
> esac
>
> case $1 in
>"state")
>   direction=`cat /sys/class/gpio/gpio$2/direction`
>   echo -n "Direction $direction, State "
>   state=`cat /sys/class/gpio/gpio$2/value`
>   if [ "$state" == "0" ]; then echo "off"; fi
>   if [ "$state" == "1" ]; then echo "on"; fi
>   exit ;;
>"label")
>   echo -n "Physical header pin number "
>   cat /sys/class/gpio/gpio$2/label ;
>   exit ;;
>"on")
>   echo 1 >/sys/class/gpio/gpio$2/value
>   exit ;;
>"off")
>   echo 0 >/sys/class/gpio/gpio$2/value
>   exit ;;
>"out")
>   echo "out" > /sys/class/gpio/gpio$2/direction ;
>   exit ;;
>"in")
>   echo "in" > /sys/class/gpio/gpio$2/direction ;
>   exit ;;
>*) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
> esac
> --Code End--
>
> Maybe someone else may find this useful.
>
> Ken
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/869c0859--452f-9471-65627c6dc9aa%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-07 Thread KenUnix
Robert,

You were correct high level is better for now. It's been a long while since 
working
with 'c'.  Went the way of a bash script. Works well see below. Even 
supports --help.

---Code Start--
#!/bin/bash
#
# 4-7-2020 Ken
#
# cmd [state|label|on|off|in|out] gpio #
# Example : cmd state 112
#
if [ "$1" == "--help" ]
   then
echo -e "\ngpio relay cape tool. 4-7-2020 KenUnix\n"
echo "state  Get state of gpio number"
echo "label  Display associated P number"
echo "on Set relay # to on"
echo "offTurn relay off"
echo -e "outSet gpio to out\n"
echo "Example: cmd status 115 Will display the state of gpio 115"
echo -e " cmd on 20  Will turn relay 1 on for gpio 20\n"
exit
fi

case $2 in
20|7|112|115) ;;
*) echo "Invalid gpio $2"
   echo "Vaild numbers are 20, 7, 112 or 115"
   echo -e "Relay 1 20, relay 2 7, relay 3 112, relay 4 115\007"
   exit 1 ;;
esac

case $1 in
   "state")
  direction=`cat /sys/class/gpio/gpio$2/direction`
  echo -n "Direction $direction, State "
  state=`cat /sys/class/gpio/gpio$2/value`
  if [ "$state" == "0" ]; then echo "off"; fi
  if [ "$state" == "1" ]; then echo "on"; fi
  exit ;;
   "label")
  echo -n "Physical header pin number "
  cat /sys/class/gpio/gpio$2/label ;
  exit ;;
   "on")
  echo 1 >/sys/class/gpio/gpio$2/value
  exit ;;
   "off")
  echo 0 >/sys/class/gpio/gpio$2/value
  exit ;;
   "out")
  echo "out" > /sys/class/gpio/gpio$2/direction ;
  exit ;;
   "in")
  echo "in" > /sys/class/gpio/gpio$2/direction ;
  exit ;;
   *) echo -e "Invalid operation $1. Try cmd --help\007" ; exit 1 ;;
esac
--Code End--

Maybe someone else may find this useful.

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/3b534de4-dbf1-468c-9067-d6636ec732f7%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-06 Thread jonnymo
Robert,

Out of curiosity, does that require having the Relay overlay loaded or is
that a default?

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-RELAY-4PORT-00A0.dts



Cheers,

Jon

On Mon, Apr 6, 2020 at 8:23 PM Robert Nelson 
wrote:

> Your trying too hard..
>
>
> Turn Relay 2 on:
>
> echo 1 > /sys/class/leds/relay-jp2/brightness
>
> Turn Relay 2 off:
>
> echo 0 > /sys/class/leds/relay-jp2/brightness
>
>
> Regards,
>
>
> On Mon, Apr 6, 2020, 10:20 PM KenUnix  wrote:
>
>> Jon,
>>> 
>>
>>
>> Yes Mala I.E. Seth have exchanged messages
>>
>> The 'c' I tried refuses to operate relays
>>
>> --Start code--
>> #include 
>> #include 
>> #include 
>> #include 
>>
>> int main()
>> {
>>   int fd = open( "/sys/class/gpio/gpio112/value", O_RDWR | O_CLOEXEC );
>>   if( fd < 0 ) {
>> fprintf( stderr, "open: %m\n" );
>> exit(1);
>>   }
>>
>>   char c = '1';
>>   write( fd, , 1 );
>>   close( fd );
>>
>>   return 0;
>> }
>> --End Code--
>>
>> No errors. Just dosen't do anything
>>
>> Ken
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "BeagleBoard" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to beagleboard+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beagleboard/f60cd784-df33-4d87-89ac-d79b7e5a43ef%40googlegroups.com
>> 
>> .
>>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/CAOCHtYgE-R0JRksFsE1XVkcXmih1HJ6RyLinif2L-tUrs9dkpA%40mail.gmail.com
> 
> .
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAG99bkrSLfjeYB6m0L2BqfT4jkVbejAHxQa9F%3DjqhiZ83tgZuA%40mail.gmail.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-06 Thread Robert Nelson
Your trying too hard..


Turn Relay 2 on:

echo 1 > /sys/class/leds/relay-jp2/brightness

Turn Relay 2 off:

echo 0 > /sys/class/leds/relay-jp2/brightness


Regards,


On Mon, Apr 6, 2020, 10:20 PM KenUnix  wrote:

> Jon,
>> 
>
>
> Yes Mala I.E. Seth have exchanged messages
>
> The 'c' I tried refuses to operate relays
>
> --Start code--
> #include 
> #include 
> #include 
> #include 
>
> int main()
> {
>   int fd = open( "/sys/class/gpio/gpio112/value", O_RDWR | O_CLOEXEC );
>   if( fd < 0 ) {
> fprintf( stderr, "open: %m\n" );
> exit(1);
>   }
>
>   char c = '1';
>   write( fd, , 1 );
>   close( fd );
>
>   return 0;
> }
> --End Code--
>
> No errors. Just dosen't do anything
>
> Ken
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/f60cd784-df33-4d87-89ac-d79b7e5a43ef%40googlegroups.com
> 
> .
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAOCHtYgE-R0JRksFsE1XVkcXmih1HJ6RyLinif2L-tUrs9dkpA%40mail.gmail.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-06 Thread KenUnix

>
> Jon, 
> 


Yes Mala I.E. Seth have exchanged messages

The 'c' I tried refuses to operate relays

--Start code--
#include 
#include 
#include 
#include 

int main()
{
  int fd = open( "/sys/class/gpio/gpio112/value", O_RDWR | O_CLOEXEC );
  if( fd < 0 ) {
fprintf( stderr, "open: %m\n" );
exit(1);
  }

  char c = '1';
  write( fd, , 1 );
  close( fd );

  return 0;
}
--End Code--

No errors. Just dosen't do anything

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/f60cd784-df33-4d87-89ac-d79b7e5a43ef%40googlegroups.com.


Re: [beagleboard] Re: 4 Relay relay Cape 'c' code

2020-04-06 Thread jonnymo
I suspect this is the Relay board you have:
https://beagleboard.org/capes

Have you looked at?
 https://github.com/beagleboard/capes

Mala had recently posted questions regarding this board.  Have you seen
this:
https://groups.google.com/forum/?utm_medium=email_source=footer#!msg/beagleboard/Zv7LaRV3TKU/WzPzcbrjBwAJ


Also, which Beagle Board are you connecting this to?


Relay,

Jon

On Mon, Apr 6, 2020 at 6:07 PM Mala Dies  wrote:

> Hello KenUnix,
>
> Seth here. I will need to type one up. I found a book a while back on
> setting up GPIO pins in C/C++ (more towards C than C++). Anyway...
>
> I think I can assist in this matter.
>
> ...
>
> I think that Adafruit_BBIO and some other libraries might go extinct soon.
> I am not familiar enough w/ Python to write my own library just yet.
>
> I am not familiar enough w/ C/C++ to type up an entire library yet either,
> e.g. mostly due to headers in C/C++ and import OS and others in Python.
>
> Seth
>
> P.S. Anyway, the book is Exploring BeagleBone by Molloy. I will get on
> this task soon. Please bear w/ me on this endeavor.
>
> On Monday, April 6, 2020 at 7:33:41 PM UTC-5, KenUnix wrote:
>>
>>
>> Could someone display an example of operating and releasing a relay in
>> 'c'?
>> And if possible getting the current state of the relay. Operated or
>> released
>> .
>> I have the relay cape from Mouser 958-RLYCPE-BBBCAPE GHI installed.
>>
>> Relay Cape. From what I read.
>> Relay 1 gpio20
>> Relay 2 gpio 7
>> Relay 3 gpio112
>> Relay 4 gpio115
>>
>> If possible code not requiring libraries or header files not normally on
>> the BBB image (RCN 10.3 Debian IoT)
>> unless I can download any required files from a URL.
>>
>> Thanks
>>
>> This is what I found so far (thanks zmatt)
>> relay 1  -  P9.41  -  gpio 0.20 (gpio20)
>> relay 2  -  P9.42  -  gpio 0.07 (gpio7)
>> relay 3  -  P9.30  -  gpio 3.16 (gpio112)
>> relay 4  -  P9.27  -  gpio 3.19 (gpio115)
>>
>>
>>
>>
> On Monday, April 6, 2020 at 7:33:41 PM UTC-5, KenUnix wrote:
>>
>>
>> Could someone display an example of operating and releasing a relay in
>> 'c'?
>> And if possible getting the current state of the relay. Operated or
>> released
>> .
>> I have the relay cape from Mouser 958-RLYCPE-BBBCAPE GHI installed.
>>
>> Relay Cape. From what I read.
>> Relay 1 gpio20
>> Relay 2 gpio 7
>> Relay 3 gpio112
>> Relay 4 gpio115
>>
>> If possible code not requiring libraries or header files not normally on
>> the BBB image (RCN 10.3 Debian IoT)
>> unless I can download any required files from a URL.
>>
>> Thanks
>>
>> This is what I found so far (thanks zmatt)
>> relay 1  -  P9.41  -  gpio 0.20 (gpio20)
>> relay 2  -  P9.42  -  gpio 0.07 (gpio7)
>> relay 3  -  P9.30  -  gpio 3.16 (gpio112)
>> relay 4  -  P9.27  -  gpio 3.19 (gpio115)
>>
>>
>>
>> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beagleboard/4f08bce6-61dc-4d9b-8471-b2fde68afcaf%40googlegroups.com
> 
> .
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/CAG99bkq6H6A2fsUPbDd2iDK_1TjXH4uf19C-L6e-5wr9KrG-_Q%40mail.gmail.com.