Setup NetBeans to develop php application in Beaglebone Black / Raspberry Pi ( Setup remote connection)

  1. Project propertiesconnectionproperties-runas

2)  connectionproperties-runas_ink_li

connectionproperties

If remote connection not setup already, then click add to create a new one.

createnewconnection

Note Initial directory, it will be root directory to upload project files by NetBeans.

Advertisements

Setup NetBeans to remote develop and debug cpp programs on Beaglebone Black or Raspberry Pi

  1. Project Properties

projpropertiesOpen Netbeans Project Properties

buildhosts

Select / create new remote build host

newhost
Add new remote host
hostloginusername
Setup new host user name

mysqlinclude

If mysql is used add include directory

linker

Set linker settings

add mysql compiler helper options`mysql_config --cflags --libs​`notice the back ticks (`) rather than (‘) apostrophe. Which denote commands that are to be executed by the shell separately (but before) the rest of the command that was issued.

 

Remote connection to MySQL in BBB/Raspberry Pi/Linux

This post describes the required settings for MySQL in BBB/Raspberry/Linux so as to connect from a remote client in non root mode.

Connect to BBB/Raspberry/Linux shell using an SSH client such as PuTTY or direct connection.


sudo nano /etc/mysql/my.cnf

change

bind-address   = localhost

to 

bind-address   = 0.0.0.0

Login to root mysql


debian@beaglebone:~$ sudo mysql -p

<enter root password>

mysql> GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%'
         IDENTIFIED BY 'user1password';

change privileges of the required user to allow
remote connection. Note % symbol, which mean it
will allow from any domain including localhost.
By default is localhost.

*.* specifies grant to all databases. You can restrict
to specific database using

yourdatabase.* instead of *.*

Restart MySQL using


sudo service mysql restart

Now you will be able to connect to MySQL using non root database accounts.

Read temperature from 1-wire in Beaglebone Black [BBB] / Raspberry Pi

debian@beaglebone:/$ cd /sys/bus/w1/devices
debian@beaglebone:/sys/bus/w1/devices$ ls
10-00080216a25a  10-00080216c818  28-031644d030ff  28-03164757c8ff  28-041651ca4dff  w1_bus_master1
debian@beaglebone:/sys/bus/w1/devices$ cat 10-00080216a25a/w1_slave
2d 00 4c 47 ff ff 02 10 51 : crc=51 YES
2d 00 4c 47 ff ff 02 10 51 t=22625
debian@beaglebone:/sys/bus/w1/devices$

cd to the folder /sys/bus/w1/devices
list files using ls
if any 1-wire sensors are connected it will appear here as below.
10-00080216a25a 10-00080216c818  28-031644d030ff  28-03164757c8ff  28-041651ca4dff 
Above are connected 1-wire temperature sensors.
DS18S20 [Starts with id 10-xxxx] and DS18B20  [Starts with id 28-xxxx] sensors
To read temperature read the file w1_slave of any sensor using command ‘cat’

Temperature is read as 22.625 ºC

Using /etc/rc.local for startup settings in Beaglebone Black (BBB)/Raspberry Pi

debian@beaglebone:/$ nano /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#export gpio, configure pin for output and set permissions to allow all users
#GPIO PIN SETUP
echo 66 > /sys/class/gpio/export
chmod 666 /sys/class/gpio/gpio66/value
chmod 666 /sys/class/gpio/gpio66/direction
echo out > /sys/class/gpio/gpio66/direction
echo 67 > /sys/class/gpio/export
chmod 666 /sys/class/gpio/gpio67/value
chmod 666 /sys/class/gpio/gpio67/direction
echo out > /sys/class/gpio/gpio67/direction

echo 68 > /sys/class/gpio/export
chmod 666 /sys/class/gpio/gpio68/value
chmod 666 /sys/class/gpio/gpio68/direction
echo out > /sys/class/gpio/gpio68/direction
#GPIO PIN SETUP END

#PWM PIN SETUP
chmod 666 /sys/devices/ocp.*/pwm_test_P9_14.*/duty
chmod 666 /sys/devices/ocp.*/pwm_test_P9_16.*/duty
chmod 666 /sys/devices/ocp.*/pwm_test_P9_29.*/duty
chmod 666 /sys/devices/ocp.*/pwm_test_P9_14.*/period
chmod 666 /sys/devices/ocp.*/pwm_test_P9_16.*/period
chmod 666 /sys/devices/ocp.*/pwm_test_P9_29.*/period
#PWN PIN SETUP END
exit 0

Using crontab to run a program at startup on Linux/Beaglebone/Raspberry Pi

debian@beaglebone:/$ crontab -e

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h&nbsp; dom mon dow&nbsp;&nbsp; command

@reboot sleep 60 && /{full path to your program}
example @reboot sleep 60 && /home/debian/myproject/dist/Release/GNU-Linux/myprog