bealgebone black 工程

本文提供了一套教程,通过实际代码示例和指南帮助用户了解如何使用BeagleBone Black的特性。包括登录设备、文件传输命令、LED控制、GPIO引脚操作、按钮输入读取等基本功能,旨在使用户快速上手硬件与软件开发。

https://press3.mcs.anl.gov/forest/hardware/beaglebone-black-software/examples-and-tutorials/

Libraries

Examples and Tutorials

This is a collection of examples and tutorial code to learn how to use features on the BeagleBone Black.  The code has been tested on Angstrom 3.8 and Ubuntu 12.04 LTS.  It is released as is under the GPL license.  I have also put together how to login to your BBB and some useful commands to transfer code to and from your BeagleBone.  We will start with this because you will need to do this for all of the examples.  I will be primarily working in Linux (Ubuntu 12.04 to be specific), but I will try to also post Windows equivalents as often as possible.  Sorry MAC users no dice.

Quick Notation Notes

  1. Code: Commands that look like this ssh root@192.168.7.2 are Linux command line commands and are meant to be typed exactly as shown

Methods to Login to your BBB
Keep in mind these are only a few methods for those who don’t know how to start.  There are an almost endless number of other ways to do this.  Also if you are using Angstrom or another OS that supports a GUI then you can connect a monitor, mouse, and keyboard and skip this.

  • USB – This uses the USB mini connection on the board to connect.
    • Linux
      • Plug the USB cable into your computer.
      • Wait for the board to initialize.  The leds should have gone all solid and be blinking.
      • Open terminal window.
      • type ssh root@192.168.7.2
      • It will prompt for a password but there isn’t one by default so just press enter
      • You should now be logged into the board home directory.
    • Windows 7
      • Plug the USB cable into your computer.
      • Wait for the board to initialize.  If this is the first time wait for the driver to load.  The leds should have gone all solid and be blinking.  Windows will also prompt a successful driver message the first time.
      • Use your favorite ssh client.  If you don’t have one I suggest Putty or Tera Term.
      • Now configure it to ssh to 192.168.7.2 on port 22
      • It will then prompt for password but there isn’t one by default so just press enter.
      • You should  now be logged into the home directory.
  • Ethernet – This method assumes you are connected to the internet and using +5V barrel connector
    • Linux
      • Install Avahi with the command sudo apt-get install avahi-daemon
      • Connect the board and wait a few seconds for it to boot.
      • Run Avahi Zeroconf Browser.
      • Find the SSH Connection for Beaglebone and click.
      • This will give you the IP address of the board so simply SSH into the board like you normally would.
    • Windows
    • Router
      • If you have a router connecting your devices simply login to the router and get the IP.
      • SSH to the board and you are off and running again.

File Transfer Commands
As with the login methods this is one of many ways.  Feel free to comment with other ways you have used for the good of everyone.

  • SCP from the BBB to your Computer
    • Send a single file
      • Open terminal window
      • Generically the command looks like this                                                                         scp user@IPAddress:/directory/filename.file /directory/
      • The first part after scp is the login information and file location on the BBB, the second part is where on the computer you want to copy it too
      • Example: scp root@192.168.7.2:/home/root/test.txt /home/
    • Send a directory
      • You can also recursively send an entire directory to sync folders
      • scp -rp user@IPAddress:/directory/ /home/directory
      • Same concept as before but now we specify the directory we want to recursively copy
      • Example: scp root@192.168.7.2:/home/root/Code/ /home/gavin/Code
  • SCP from your Computer to Beaglebone
    • Same concept but in reverse
    • send a file: scp /home/filename.file user@IPAddress:/directory
    • send a directory: scp -rp /directory/ user@IPAddress:/directory
    • Example:                                                                                                                               scp /home/gavin/test.txt root@192.168.7.2:/home/root/Desktop/
    • Example:                                                                                                                               scp -rp /home/gavin/Code/ root@192.168.7.2:/home/root/Code/

Example 0 – Blinking A User LED
This example is your “Hello World” for the BBB.  This will show how to use file operations to change the state of one of the onboard user leds.  It also uses the time.h header to develop a function that pauses for a specified number of seconds.  A function to pause less than a second will be shown later.

Instructions
1a. Download Example 0 code (you have your choice of .tar or .zip) here and SCP the code or another method to get it on your board.
1b. Use svn: svn checkout https://repos.anl-external.org/repos/redac/BeagleBoneBlack/Examples/
2. Open a terminal window
3. Extract the code and navigate to the folder location: tar -xvf filename.tar filename
4. type make
5. type ./blinkusr to run the program

Example 1 – Blinking A GPIO Pin
This expands on the previous example by now blinking and led that is connected to one of the GPIO pins.  For this example, wiring an led with a 1K resistor to GPIO1_13 which is P8_11 on the headers.  Remember if you want to use a larger resistor to keep I/O drive current under 4 or 6 mA depending on the pin and 8 mA sink current a transistor can be added to switch the additional current.

Instructions
1a. Download Example 1 code (you have your choice of .tar or .zip) here and SCP the code or another method to get it on your board.
1b. Use svn: svn checkout https://repos.anl-external.org/repos/redac/BeagleBoneBlack/Examples/
2. Open a terminal window
3. Extract the code and navigate to the folder location: tar -xvf filename.tar filename
4. type make
5. type ./blinkled to run the program

Example 2 – Reading Button Input
The next logically step after learning to output a signal is to learn how to read an input signal.  This example will show you how to read the state of a button.  The internal pullup/pulldown resistors are not used here so you will need to wire in your button into GPIO1_15 or P8_15 with that in mind.

Instructions

 

内容概要:本研究聚焦于“绿电直连型电氢氨园区”的优化运行,提出一种直接利用绿色电力驱动制氢与合成氨的综合能源系统架构。通过构建包含风/光发电、电解水制氢、氢气储存、合成氨反应及电能直供等关键环节的系统模型,研究旨在实现能源的高效转化与梯级利用,降低对外部电网依赖,提升园区能源自洽率与经济性。研究综合运用Matlab与Python工具进行建模与仿真,结合实际气象与负荷数据,对系统在不同工况下的运行策略、能量流动、设备容量配置及经济技术指标进行深入分析与优化,并形成完整的Word论文文档,为新型零碳产业园区的规划与建设提供了理论依据和技术支撑。; 适合人群:具备新能源、电力系统、化工或综合能源系统背景的科研人员,以及从事园区规划、能源管理、低碳技术开发的工程技术人员。; 使用场景及目标:①研究绿电如何高效耦合至化工生产流程,实现“电-氢-氨”多能互补;②掌握综合能源系统(IES)的建模、仿真与优化方法,特别是多时间尺度下的运行调度策略;③为撰写高水平学术论文或完成相关课题研究积累数据、代码与写作模板。; 阅读建议:此资源包含代码、数据和完整论文,建议使用者先通读Word论文以理解整体框架与理论基础,再结合Matlab/Python代码进行复现与调试,最后可基于提供的数据和模型进行二次开发,以深化对绿电综合利用技术的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值