3055|0

5015

帖子

12

TA的资源

裸片初长成(初级)

楼主
 

Energia的基本功能 [复制链接]

这里给出一个Energia操作的基本列表:
1.Basics
  • BareMinimum: The bare minimum of code needed to start an Energia sketch.
  • Blink: Turn an LED on and off.
  • DigitalReadSerial: Read a switch, print the state out to the Energia Serial Monitor.
  • AnalogReadSerial: Read a potentiometer, print it's state out to the Energia Serial Monitor.
  • Fade: Demonstrates the use of analog output to fade an LED.
  • ReadAnalogVoltage : Reads an analog input and prints the voltage to the serial monitor

2.Digital
  • Blink Without Delay: blinking an LED without using the delay() function.
  • Button: use a pushbutton to control an LED.
  • Debounce: read a pushbutton, filtering noise.
  • Button State Change: counting the number of button pushes.
  • Input Pullup Serial: Demonstrates the use of INPUT_PULLUP with pinMode().
  • Tone: play a melody with a Piezo speaker.
  • Pitch follower: play a pitch on a piezo speaker depending on an analog input.
  • Simple Keyboard: a three-key musical keyboard using force sensors and a piezo speaker.
  • Tone4: play tones on multiple speakers sequentially using the tone() command.

3.Analog
  • AnalogInOutSerial: read an analog input pin, map the result, and then use that data to dim or brighten an LED.
  • Analog Input: use a potentiometer to control the blinking of an LED.
  • AnalogWrite: fade 7 LEDs on and off, one by one, using an MSP430G2 LaunchPad board.
  • Calibration: define a maximum and minimum for expected analog sensor values.
  • Fading: use an analog output (PWM pin) to fade an LED.
  • Smoothing: smooth multiple readings of an analog input.

4.Communication

These examples include code that allows the LaunchPad to talk to Processing sketches running on the computer. For more information or to download Processing, see processing.org.


  • ReadASCIIString: parse a comma-separated string of ints to fade an LED
  • ASCII Table: demonstrates Energia's advanced serial output functions.
  • Dimmer: move the mouse to change the brightness of an LED.
  • Graph: send data to the computer and graph it in Processing.
  • Physical Pixel: turn a LED on and off by sending data to your LaunchPad from Processing.
  • Virtual Color Mixer: send multiple variables from LaunchPad to your computer and read them in Processing.
  • Serial Call Response: send multiple vairables using a call-and-response (handshaking) method.
  • Serial Call Response ASCII: send multiple variables using a call-and-response (handshaking) method, and ASCII-encode the values before sending.
  • SerialEvent: Demonstrates the use of SerialEvent().
  • Serial input (Switch (case) Statement): how to take different actions based on characters received by the serial port.
  • MIDI: send MIDI note messages serially.
  • MultiSerial: use two of the serial ports available on the LaunchPad.

5.Control Structures
  • If Statement (Conditional): how to use an if statement to change output conditions based on changing input conditions.
  • For Loop: controlling multiple LEDs with a for loop.
  • Array: a variation on the For Loop example that demonstrates how to use an array.
  • While Loop: how to use a while loop to calibrate a sensor while a button is being read.
  • Switch Case: how to choose between a discrete number of values. Equivalent to multiple If statements. This example shows how to divide a sensor's range into a set of four bands and to take four different actions depending on which band the result is in.
  • Switch Case 2: a second switch-case example, showing how to take different actions based in characters received in the serial port.

6.Strings
  • StringAdditionOperator: add strings together in a variety of ways.
  • StringAppendOperator: append data to strings.
  • StringCaseChanges: change the case of a string.
  • StringCharacters: get/set the value of a specific character in a string.
  • StringComparisonOperators: compare strings alphabetically.
  • StringConstructors: how to initialize string objects.
  • StringIndexOf: look for the first/last instance of a character in a string.
  • StringLength & StringLengthTrim: get and trim the length of a string.
  • StringReplace: replace individual characters in a string.
  • StringStartsWithEndsWith: check which characters/substrings a given string starts or ends with.
  • StringSubstring: look for "phrases" within a given string.


 
点赞 关注
个人签名《MCU工程师炼成记》作者之一

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表