element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Design for a Cause - Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Design for a Cause - Design Challenge
  • More
  • Cancel
Design for a Cause - Design Challenge
Blog Blowing-Whistle as Controller(BWaC) -----Make use of ScheduleTable for Arduino #8
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fyaocn
  • Date Created: 3 Sep 2018 7:15 AM Date Created
  • Views 661 views
  • Likes 3 likes
  • Comments 0 comments
Related
Recommended

Blowing-Whistle as Controller(BWaC) -----Make use of ScheduleTable for Arduino #8

fyaocn
fyaocn
3 Sep 2018

1. According to datasheet, the MKR1000 with Cortex-M0 signle-core SoC can run in normal operation sequence fairly well, ie, in serial running mode. Each code runs one by one, the interrupt can be attached for unexpected incident.

But this in not fit for the BWaC project, thread would be better for multi-sensors and selective one-to-more control logic.

Therefore, ScheduleTable is used as framework for this project. There are different process running, until the preset signal is triggered.

 

2. The schedule table is a data structure to schedule actions along a timeline. A schedule table has a period and can process one or more actions. The library can be download from arduino library management with key search work of "schedule table".

 

First, include the header file,

#include <ScheduleTable.h>

Then, creating a schedule table. Typical form like this,

SchedTable<2> blinkLED(500);

     Schedule one table with 2 actions and a 500ms period. This is done by using a SchedTable class instance. By default the time base is in milliseconds.

     or,

SchedTable<2> blinkLED(10,50);

     Schedule the timebase of the schedule table to 50ms so that period is now expressed in multiple of 50ms.

Next, adding actions and start a schedule table . The functions called by the schedule table. An action is a function that returns nothing and has no argument. The ledOn() and ledOn() are function to run on the time scheduled.

image

blinkLED.at(200,ledOn);
blinkLED.at(250,ledOff);
...  ...
blinkLED.start();

 

In the loop(), update the Schedule Table accordingly.

ScheduleTable::update();
... ...

 

Finally, your can stop the schedule table

blinkLED.stop();

     or let it stops on preset cycles like, print hello 10 times.

helloCycle.start(10);

 

3. Here is the example of print hello 10 times,

#include <ScheduleTable.h>
SchedTable<1> helloCycle(1000);
void hello()
{
  static byte count = 0;
  Serial.print(++count);
  Serial.print(" Hello, MKR1000 ");
  Serial.println(millis());
}


void setup()
{
  Serial.begin(9600);
  helloCycle.at(1000,hello);
  helloCycle.start(10);
}


void loop()
{  ScheduleTable::update();}

 

image

 

4. Here is my framework. The core process supervises the microphone module for control signal and screens for valid Whistle command. The  sensors and actuators polling the room status in schedule table even some are male-functional. Each command read the sensor or run the curator like servo or motor.

Any modification of the hardware would not interfere with other part of the codes.

Here is the diagram to be used in the program.

image

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube