Jelle
Published © GPL3+

Quick Start Making Complex Controls with Arduino MEGA 2560

Part 1. Skip boring definitions, define necessary I/O and start coding your complex control based on a finite state machine.

IntermediateProtip4 hours499
Quick Start Making Complex Controls with Arduino MEGA 2560

Things used in this project

Hardware components

Arduino Mega 2560 & Genuino Mega 2560
Arduino Mega 2560 & Genuino Mega 2560
×1

Software apps and online services

Microsoft Visual studio community 2017
Visual Micro

Story

Read more

Code

UserConfiguration

VBScript
Generated by Configurator
// UserConfiguation.h
//
//
//*========================================================================================
//*========================================================================================
//*============  START USER CONFIGURATION FOR THE I/O   ===================================
//*========================================================================================
//*========================================================================================
//
// Define all used pins for the application.
//
// The range of digitals is commenly used. First to define the inputs,outputs and ultrasonics.
// The analog out en servo pins are in the PWN range of the board.
//
//%STARTGENERATION Generation directive, dont remove!
const byte NoInputPins  = 0;
const byte NoOutputPins = 2;
const byte NoUltrasonic = 0;
const byte NoAnaInPins  = 0;
const byte NoAnaOutPins = 0;
const byte NoServos     = 0;
const byte NoTemp       = 1;
String DummyTags[]      = { "" };
String InputTags[]      = { "" };
String InputPins[]      = { "" };
String OutputTags[]     = { "HEATER","ALARM" };
String OutputPins[]     = { "D30","D31" };
String AnaInTags[]      = { "" };
String AnaInPins[]      = { "" };
String AnaOutTags[]     = { "" };
String AnaOutPins[]     = { "" };
String ServoTags[]      = { "" };
String ServoPins[]      = { "" };
String UltraTags[]      = { "" };
String UltraPins[]      = { "" };
const byte OneWireChannel = 03;
String TempTags[]       = { "TTWATER" };
String TempPins[]       = { "PWM03" };
//%ENDGENERATION Generation directive dont remove!
// 
// Markers not yet implemeted in the configurator
const byte NoMarkers = 0;
String MarkerTags[] = { "" };
//
// Declaration of all used states in the FSM.
// The first and last state "START"and "END" are obligatory and may not be removed, the rest is up to you
//
//
String PossibleFSMStates[] = { "START",
                               "END" };
//
// Start defining User timers don't use predefined timers (stay out of range 200-300)
//
const byte timTask1 = 1;
const byte timTask2 = 2;
//
// End defining user tinmers
//
// START USER SPECIFIC DECLARATIONS
//
// Start User varaibles:
//
boolean AanUitTask1;
boolean AanUitTask2;
// End User varaibles:
//
// use of the extra MEGA board for the messages, use MessageI2C and/or UseHMISerial, do not remove, only set true or false
//
boolean UseI2C = false;
boolean UseHMISerial = true;
boolean UseGPS = false;
boolean UseIntercard = false;
//
//*========================================================================================
//*========================================================================================
//*==============  END USER CONFIGURATION =================================================
//*========================================================================================
//*========================================================================================

Credits

Jelle

Jelle

8 projects • 16 followers
I'am developing software only during rainy days.

Comments