This video show how to setup Remote Java SE Platform in Netbeans IDE running on Windows 10, deploy JavaFX application running on Raspberry Pi 2/Raspbian Jessie. Actually, it's same as in Raspbian Wheezy.
In my experience, it cannot be perform using sudo, you have to login as root. To login as root, refer to the post "Set password of root".
pyGPIO.py
import sys
import os
import RPi.GPIO as GPIO
import time
print("**********************************************")
print("*** Toggle PWR/ACT LED on Raspberry Pi 2 B ***")
print("*** for Raspberry Pi 2 B only ***")
print("**********************************************")
print("- System info -")
print(sys.version)
print("GPIO.VERSION: " + GPIO.VERSION)
print("GPIO.RPI_REVISION (deprecated): " + str(GPIO.RPI_REVISION))
print("")
print("GPIO.RPI_INFO:")
print(GPIO.RPI_INFO)
print("")
for keys,values in GPIO.RPI_INFO.items():
print(keys + " : " + str(values))
print("")
#display trigger for led0 and led1
print("- Original trigger for led 0 -")
os.system("cat /sys/class/leds/led0/trigger")
print("- Original trigger for led 1 -")
os.system("cat /sys/class/leds/led1/trigger")
print("remove the trigger for led0 and led1")
os.system("echo none >/sys/class/leds/led0/trigger")
os.system("echo none >/sys/class/leds/led1/trigger")
os.system("cat /sys/class/leds/led0/trigger")
os.system("cat /sys/class/leds/led1/trigger")
print("")
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(35, GPIO.OUT) #Red PWR LED on RPi2B
GPIO.setup(47, GPIO.OUT) #Green Activity LED on RPi2B
for num in range(1, 5):
print num
#Control led0 with RPi.GPIO
GPIO.output(47, False) #Turn OFF ACT LED for RPi 2 B
GPIO.output(35, True) #Turn ON PWR LED for RPi 2 B
print "LED PWR(RED)-ON ACT(GREEN)-OFF"
time.sleep(2)
#Control led1 with system's shell
os.system("echo 1 >/sys/class/leds/led0/brightness")
os.system("echo 0 >/sys/class/leds/led1/brightness")
print "LED PWR(RED)-OFF ACT(GREEN)-ON"
time.sleep(3)
print("")
print("Finished")
#rsume the trigger for led0 and
#assume it's mmc0 and input
os.system("echo mmc0 >/sys/class/leds/led0/trigger")
os.system("echo input >/sys/class/leds/led1/trigger")
print("- Resummed trigger for led 0 -")
os.system("cat /sys/class/leds/led0/trigger")
print("- Resummed trigger for led 1 -")
os.system("cat /sys/class/leds/led1/trigger")
print("")
I have a old example "Control the on-board LED using Python" to toggle Raspberry Pi 1 ACT LED. It's updated to toggle the ACT LED on Raspberry Pi 2.
On Raspberry Pi 2 B, the ACT LED is assigned pin 47.
pyGPIO.py
import sys
import RPi.GPIO as GPIO
import time
print(sys.version)
print("GPIO.VERSION: " + GPIO.VERSION)
print("GPIO.RPI_REVISION (deprecated): " + str(GPIO.RPI_REVISION))
print("")
print("GPIO.RPI_INFO:")
print(GPIO.RPI_INFO)
print("")
for keys,values in GPIO.RPI_INFO.items():
print(keys + " : " + str(values))
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
#GPIO.setup(16, GPIO.OUT)
GPIO.setup(47, GPIO.OUT)
for num in range(1, 5):
print num
#GPIO.output(16, True) ##Turn OFF LED
GPIO.output(47, False) ##Turn OFF LED for RPi 2 B
print "LED OFF"
time.sleep(2)
#GPIO.output(16, False) ##Turn ON LED
GPIO.output(47, True) ##Turn ON LED for RPi 2 B
print "LED ON"
time.sleep(3)
#GPIO.output(16, True) ##Turn OFF LED
GPIO.output(47, False) ##Turn OFF LED for RPi 2 B
In my experience, it cannot be perform using sudo, you have to login as root. To login as root, refer to the post "Set password of root".
Then login as root.
by default, the ACT LED is set triggered by mmc0. It can be checked with the command:
- Install Windows IoT Core Project Templates for Visual Studio 2015, Install Windows IoT Core Project Templates for Visual Studio 2015, directly from Visual Studio in the Extension and Updates dialog (Tools - Extensions and Updates - Online).
Windows 10 IoT Core Team are excited to announce the public release of Windows 10 IoT Core! With this are bringing the capabilities of Windows 10 to boards like the Raspberry Pi 2. Learn more about this exciting new release in the blog post, "Hello, Windows 10 IoT Core". You can download it now for free to use in your projects.
To celebrate the release, the "Windows 10 IoT Core - Home Automation Contest" is announced in collaboration with http://www.hackster.io/. To participate, build a home automation solution that leverages the power of Windows 10 IoT Core running on Raspberry Pi 2. The two grand prizes are a trip to Maker Faire, New York for a winner from US and to Maker Faire, Rome for a winner from Europe to demo your projects to your fellow Makers. Other prizes include up to $2000 in gift certificates and a free Raspberry Pi 2 kit to the top 100 shortlisted projects!
Starting today you can download Windows 10 IoT Core Insider Preview with support for Raspberry Pi 2 and Intel’s Minnowboard Max. Windows 10 IoT Core is a new Windows 10 edition for low-cost, small-footprint devices that will be available ‘free’ for Makers and commercial device builders.
I use a DVI-HDMI cable to connect my Raspberry Pi 2 to Monitor. Originally, it can recognize the monitor as 1440x900. Suddenly, it cannot recognize it, and treat it as 640x480. Something fail on my RPi 2!? I know how to manually set resolution on /boot/config.txt, but I want it detect automatically.
This video show The cooling effect of fan case for Raspberry Pi 2. Run the Raspberry Pi 2 inside a open top case, to stable around 48C, then cover with fan, the temperature drop to around 37C.
In Linux, the file "/sys/devices/system/cpu/*/cpufreq/scaling_cur_freq" show the available frequency your CPU(s) are scaled to currently, in KHz.
In Raspberry Pi 2/Raspbian, where is:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq
This Python 2 example run on Raspberry Pi 2, to display CPU frequency graphically. (It seem that all CPU run on the same frequency)
plotCpuFreq.py
import os
import matplotlib.pyplot as plt
from drawnow import *
# Run on Raspberry Pi 2
# 4 CPUs
cpu0Freq = []
cpu1Freq = []
cpu2Freq = []
cpu3Freq = []
plt.ion()
cnt=0
def plotCpuFreq():
plt.ylim(0,1500000)
plt.title('Raspberry Pi 2 CPUs Frequency')
plt.grid(True)
plt.ylabel('KHz')
plt.plot(cpu0Freq, 'r^-', label='cpu0')
plt.plot(cpu1Freq, 'c>-', label='cpu1')
plt.plot(cpu2Freq, 'bv-', label='cpu2')
plt.plot(cpu3Freq, 'm<-', label='cpu3')
plt.legend(loc='upper right')
#pre-load dummy data
for i in range(0,100):
cpu0Freq.append(0)
cpu1Freq.append(0)
cpu2Freq.append(0)
cpu3Freq.append(0)
while True:
cpu0 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq").readline()
cpu1 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq").readline()
cpu2 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq").readline()
cpu3 = os.popen("awk '{print $1}' /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq").readline()
print(cpu0 + " " + cpu1 + " " + cpu2 + " " + cpu3)
cpu0Freq.append(cpu0)
cpu0Freq.pop(0)
cpu1Freq.append(cpu1)
cpu1Freq.pop(0)
cpu2Freq.append(cpu2)
cpu2Freq.pop(0)
cpu3Freq.append(cpu3)
cpu3Freq.pop(0)
drawnow(plotCpuFreq)
plt.pause(1)
The file /proc/loadavg indicate the load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes. This Python 2 example read the first figure (over 1 minutes) every second, and plot to figure using Matplotlib.
plotLoadAvg.py
import os
import matplotlib.pyplot as plt
from drawnow import *
loadavg = []
plt.ion()
cnt=0
def plotLoadAvg():
plt.ylim(0,4)
plt.title('Raspberry Pi load average')
plt.grid(True)
plt.ylabel('usage')
plt.plot(loadavg, 'bo-', label='usage')
plt.legend(loc='upper right')
#pre-load dummy data
for i in range(0,100):
loadavg.append(0)
while True:
usage = os.popen("awk '{print $1}' /proc/loadavg").readline()
print(usage)
loadavg.append(usage)
loadavg.pop(0)
drawnow(plotLoadAvg)
plt.pause(1)
NetBeans IDE is the official IDE for Java 8. With quad-core ARM Cortex-A7 CPU on Raspberry Pi 2, pre-loaded Java 8 on Raspbian, it's easy to install NetBeans 8 on Raspberry Pi.
Originally, I set Color depth of High color (15 bpp), it work once only. After then, I run netbeans next time, it fail with following error:
x Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 72 (x_PutImage)
Serial number of failed request: 51
Current serial number in output stream: 55
To fix it in my case, set Color depth of High color (16 bpp).