This document discusses using JavaScript for embedded programming on microcontrollers. It introduces Espruino, which allows programming microcontrollers using JavaScript. Espruino provides inexpensive hardware with peripherals and libraries, making it suitable for hobbyists and prototyping. In contrast to Arduino, Espruino includes a debugger. The document demonstrates examples of using Espruino to read temperature and humidity sensors and expose sensor data over Bluetooth Low Energy. It encourages exploring Espruino and related projects like Tessel and Neonious for embedded JavaScript development.
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이GangSeok Lee
2012 CodeEngn Conference 06
Secuinside는 코스콤에서 주최, 연합해킹그룹 HARU, 고려대 정보보호대학원에서 주관하는 국제 해킹대회 및 보안컨퍼런스로써 얼마전 개최된 해킹대회 예선전 문제들을 풀기위해 사용한 분석기술과 ASLR과 NX를 우회하는 새로운 익스플로잇 기술에 대해서 소개한다.
http://codeengn.com/conference/06
Implementation of the ZigBee ZCL Reporting Configuration FeaturesSimen Li
This slide presents the implementation of the ZigBee ZCL Reporting Configuration features by taking TI Z-Stack Home 1.2.1 SampleLight project as an example.
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMULinaro
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
Speaker: Alex Bennée
Date: September 22, 2015
★ Session Description ★
While QEMU has continued to be optimised for KVM to make use of the growing number of cores on modern systems, TCG emulation has been stuck running in a single thread. This year there is another push to get a workable solution merged upstream. We shall present a review of the challenges that need to be addressed: locking, TLB and cache maintenance and generic solution for the various atomic/exclusive operations. We will discuss previous work that has been done in this field before presenting a design that addresses these requirements. Finally we shall look at the current proposed patches and the design decisions they have taken.
★ Resources ★
Video: https://www.youtube.com/watch?v=9xQGDTEmNtI
Presentation: http://www.slideshare.net/linaroorg/sfo15202-towards-multithreaded-tiny-code-generator-tcg-in-qemu
Etherpad: pad.linaro.org/p/sfo15-202
Pathable: https://sfo15.pathable.com/meetings/302833
★ Event Details ★
Linaro Connect San Francisco 2015 - #SFO15
September 21-25, 2015
Hyatt Regency Hotel
http://www.linaro.org
http://connect.linaro.org
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이GangSeok Lee
2012 CodeEngn Conference 06
Secuinside는 코스콤에서 주최, 연합해킹그룹 HARU, 고려대 정보보호대학원에서 주관하는 국제 해킹대회 및 보안컨퍼런스로써 얼마전 개최된 해킹대회 예선전 문제들을 풀기위해 사용한 분석기술과 ASLR과 NX를 우회하는 새로운 익스플로잇 기술에 대해서 소개한다.
http://codeengn.com/conference/06
Implementation of the ZigBee ZCL Reporting Configuration FeaturesSimen Li
This slide presents the implementation of the ZigBee ZCL Reporting Configuration features by taking TI Z-Stack Home 1.2.1 SampleLight project as an example.
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMULinaro
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
Speaker: Alex Bennée
Date: September 22, 2015
★ Session Description ★
While QEMU has continued to be optimised for KVM to make use of the growing number of cores on modern systems, TCG emulation has been stuck running in a single thread. This year there is another push to get a workable solution merged upstream. We shall present a review of the challenges that need to be addressed: locking, TLB and cache maintenance and generic solution for the various atomic/exclusive operations. We will discuss previous work that has been done in this field before presenting a design that addresses these requirements. Finally we shall look at the current proposed patches and the design decisions they have taken.
★ Resources ★
Video: https://www.youtube.com/watch?v=9xQGDTEmNtI
Presentation: http://www.slideshare.net/linaroorg/sfo15202-towards-multithreaded-tiny-code-generator-tcg-in-qemu
Etherpad: pad.linaro.org/p/sfo15-202
Pathable: https://sfo15.pathable.com/meetings/302833
★ Event Details ★
Linaro Connect San Francisco 2015 - #SFO15
September 21-25, 2015
Hyatt Regency Hotel
http://www.linaro.org
http://connect.linaro.org
This presentation is Part 2 of 3 illustrating ARM® Cortex™ M boot sequence. Hands on illustration uses EFM®32 Zero Gecko starter kit based on Cortex M0+ core from Silicon Labs.
Simplicity Studio IDE from Silicon Labs was used to create a sample project (Bundled with Simplicity Studio), set breakpoints and inspect various entry points and other points of interest to get a introductory look at Cortex boot sequence
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
What will be quantization step size in numbers and in voltage for this Arduino Code? Using 5V
const int led1 = 2;
const int led2 = 3;
const int led3 = 4;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
int dataConv = sensorValue*(8.0/1024);
//write analog equvivalant data on led pins
switch(dataConv)
{
case 0: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 1: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 2: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 3: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 4: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 5: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 6: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
case 7: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
}
Serial.println(sensorValue); // print out the value you read:
Serial.println(dataConv);
delay(1000); // delay in between reads for stability
}
const int led1 = 2;
const int led2 = 3;
const int led3 = 4;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
int dataConv = sensorValue*(8.0/1024);
//write analog equvivalant data on led pins
switch(dataConv)
{
case 0: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 1: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
break;
}
case 2: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 3: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
break;
}
case 4: {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 5: {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
break;
}
case 6: {
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
case 7: {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
break;
}
}
Serial.println(sensorValue); // print out the value you read:
Serial.println(dataConv);
delay(1000); // delay in between reads for stability
}
Solution
// Random LED Dots - from noise source
// Ed Nisley - KE4ANU - September 2015
//----------
// Pin assignments
const byte PIN_HEARTBEAT = 8; // DO - heartbeat LED
const byte PIN_SYNC = A3; // DO.
The slide introduce some of the Rust concept that are necessary to write a kernel. Including wrapping an CSRs operation, locking mutable static variable, memory allocator, and pointer in Rust.
Please visit the project github to see the source code of the rrxv6 projects:
https://github.com/yodalee/rrxv6
This talk is all about the Berkeley Packet Filters (BPF) and their uses in Linux.
Agenda:
* What is a BPF and why do we need it?
* Writing custom BPFs
* Notes on BPF implementation in the kernel
* Usage examples: SOCKET_FILTER & seccomp
Speaker:
Kfir Gollan, senior embedded software developer, Linux kernel hacker and software team leader.
#include avrinterrupt.h The global interrupt flag is maintained.pdfarasanlethers
#include //The global interrupt flag is maintained in the I bit of the status register (SREG).
#include //This header file includes the apropriate IO definitions for the device that has been
specified by the -mmcu= compiler command-line switch. This is done by diverting to the
appropriate file which should never be included directly. Some register names common to all
AVR devices are defined directly within , which is included in , but most of the details come
from the respective include file.
#include //The functions in this header file are wrappers around the basic busy-wait functions
from . They are meant as convenience functions where actual time values can be specified rather
than a number of cycles to wait for. The idea behind is that compile-time constant expressions
will be eliminated by compiler optimization so floating-point expressions can be used to
calculate the number of delay cycles needed based on the CPU frequency passed by the macro
F_CPU.
#include \"oi.h\"//This header file includes the apropriate IO definitions
//the #define directive allows the definition of macros within your source code. These macro
definitions allow constant values to be declared for use throughout your code. Macro definitions
are not variables and cannot be changed by your program code like variables.
#define USB 1
#define CR8 2 // toggle between usb and create on CM serial processor
//Methods used in program
void setSerial(uint8_t com);
uint8_t getSerialDestination(void);/*------------------------built in, sends back Serial Destination*/
void writeChar(char c, uint8_t com);/*------------ --taken from command modual manual. sends
data to computer via the USB cable*/
void delay(void);/* Checks the delayed period*/
void byteTx(uint8_t value);/*Transmit a byte over the serial port*/
void Init_Uart(void);/* Initialize the values */
uint8_t byteRx(void);/*------------------------------reads from the serial port*/
//This is main method for the program
void main(void)
{
uint8_t rx_data;
Init_Uart();
/* Writing the character by character using the while loop */
while(1)
{
writeChar(\'H\',USB);
writeChar(\'e\',USB);
writeChar(\'l\',USB);
writeChar(\'l\',USB);
writeChar(\'o\',USB);
writeChar(\' \',USB);
writeChar(\'W\',USB);
writeChar(\'o\',USB);
writeChar(\'r\',USB);
writeChar(\'l\',USB);
writeChar(\'d\',USB);
writeChar(\'!\',USB);
}
}
/*Initialize the values */
void Init_Uart(void)
{
UBRR0 = 59;
UCSR0B = 0x18;
UCSR0C = 0x06;
DDRB = 0X10;
PORTB = 0X10;
}
/*Used to check the delayed time */
void delay(void)
{
int i=0,j=0;
for(i=1;i<=1000;i++)
{
for(j=1;j<=1000;j++)
{
}
}
}
//****************************************************************************
****************
/*the following three functions came directly from the command module manual
they change the flow of data so that when byteTx is called it sends data
from the create to the computer through the USB cable. when it is done sending
data it returns the com port to its original state, giving commands to .
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
10. Die Revolution: Arduino!
- Preiswerte Hardware
- Viel (preiswerte) Peripherie inkl. Bibliotheken verfügbar
- Für Hobbyanwender/Quereinsteiger/Rapid Prototyping gut geeignet
- Kein Debugger
15. Beispiel: Temperatur
function onTimer() {
// Messwert vom Temperatursensor auslesen
var t = E.getTemperature().toFixed(1);
// Backbuffer loeschen
g.clear();
// Kleine Schriftart für die Titelzeile auswaehlen
g.setFontBitmap();
// Titelzeile zeichnen
g.drawString("Temperature:");
// Grosse Schriftart für den Messwert auswaehlen
g.setFontVector(40);
// Messwert zentriert zeichnen, 10px Abstand vom oberen Rand
g.drawString(t, (g.getWidth() - g.stringWidth(t))/2, 10);
// Backbuffer auf Display darstellen
g.flip();
}
// Messwert und Display-Inhalt alle zwei Sekunden aktualisieren
setInterval(onTimer,2000);
// Initiale Darstellung des Messwertes
onTimer();
16. Beispiel: Luftfeuchtigkeit
// I2C-Schnittstelle konfigurieren
I2C1.setup( {scl: A5, sda: A4 } );
// HTU21D-Modul laden und über I2C-Schnittstelle verbinden
var htu = require('HTU21D').connect( I2C1 );
function onTimer() {
// Messwert vom Luftfeuchtesensor auslesen
var t = htu.readHumidity().toFixed(1);
// Backbuffer loeschen
g.clear();
// Kleine Schriftart für die Titelzeile auswaehlen
g.setFontBitmap();
// Titelzeile zeichnen
g.drawString("Humidity:");
// Grosse Schriftart für den Messwert auswaehlen
g.setFontVector(40);
// Messwert zentriert zeichnen, 10px Abstand vom oberen Rand
g.drawString(t, (g.getWidth() - g.stringWidth(t))/2, 10);
// Backbuffer auf Display darstellen
g.flip();
}
// Messwert und Display-Inhalt alle zwei Sekunden aktualisieren
setInterval(onTimer,2000);
// Initiale Darstellung des Messwertes
onTimer();
17. Beispiel: Bluetooth LE
// I2C-Schnittstelle konfigurieren
I2C1.setup( {scl: A5, sda: A4 } );
// HTU21D-Modul laden und über I2C-Schnittstelle verbinden
var htu = require('HTU21D').connect( I2C1 );
// Verfuegbare BLE Services und Charakteristiken bekannt machen
NRF.setServices({
// Envrionmental Sensing Service konfigurieren
0x181A: {
// Temperatur Charakteristik konfigurieren
0x2A6E: {
readable: true,
notify: true,
writeable: false,
value: new Int16Array([E.getTemperature() * 100]).buffer
},
// Luftfeuchte Charakteristik konfigurieren
0x2A6F: {
readable: true,
notify: true,
writeable: false,
value: new Uint16Array([htu.readHumidity() * 100]).buffer
}
}
// Envrionmental Sensing Service bekannt machen
}, {advertise: ['0x181A']});
// Messwerte erfassen und Benachrichtigungen versenden
function onTimer() {
NRF.updateServices({
// Envrionmental Sensing Service aktualisieren
0x181A: {
// Temperatur Charakteristik aktualisieren
0x2A6E: {
value: new Int16Array([E.getTemperature() * 100]).buffer,
notify: true
},
// Luftfeuchte Charakteristik aktualisieren
0x2A6F: {
value: new Uint16Array([htu.readHumidity() * 100]).buffer,
notify: true
}
}
});
}
NRF.on('connect', function(addr) {
// Messwert aktualisieren und uebermitteln
setInterval(onTimer, 2000);
// Initiale Uebermittlung des Messwertes
onTimer();
});