Example project for the Rioux Chem control box

Dependencies:   mbed MODSERIAL

Dependents:   screentest

Rioux Chem Control Box

/media/uploads/emh203/ccb.jpg

This is the example project for the Rioux Chem Control Box. I have posted some youtube videos to guide you through the hardware and software:

Rioux Chem Control Box - Hardware

http://www.youtube.com/watch?v=MoZ92GRYa4s

Rioux Chem Control Box - Software - Part I

http://www.youtube.com/watch?v=_MwaTLL4dyA==

Rioux Chem Control Box - Software - Part II

http://www.youtube.com/watch?v=j_P89izfgoQ

Revision:
0:7798270c1f52
Child:
2:73a028278c5c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jan 25 19:10:17 2014 +0000
@@ -0,0 +1,93 @@
+#include "mbed.h"
+#include "CHEM_BOX_INTERFACE.h"
+
+Timer ControlLoopTimer;
+float CurrentTemperature;
+
+
+int main() 
+{
+    int i;
+
+    //This function always needs called before you do anythign wit the CHEM BOX.
+    InitChemBox();
+
+    //Beep 6 times
+    for(i=0;i<6;i++)
+      {
+        Buzz(.05);  //Since the Buzz function immediately returns we should wait a bit before calling it again in the loop
+        wait(.1);   //I want a 50% duty cycle so I will wait twice as long as my previous Buzz() call
+     }
+     
+     
+      //Here is an example of how to draw on the screen!
+      
+      //This makes the backlight white.   Each color can be between 0 and 3 (integers... 0,1,2,3)
+      SmartSwitch_SetBackLightColor(3, 3, 3);
+      
+      //The display routines are fully buffered.   When you call the draw routines,  the write to the backbuffer, not the screen.
+      //The flow is to clear the backbuffer,   call all the drawing routines,  then dump the backbuffer to the screen.   
+      
+      //This clears the back buffer
+      GFX_FullDisplayBufferClear(&BackBuffer);
+      
+      //Draw a box around the edge of the screen
+      
+      GFX_DrawLine(&BackBuffer, 0,0, PHYSICAL_DISPLAY_XRES - 1,0);
+      GFX_DrawLine(&BackBuffer, PHYSICAL_DISPLAY_XRES - 1,0,PHYSICAL_DISPLAY_XRES - 1 ,PHYSICAL_DISPLAY_YRES - 1);
+      GFX_DrawLine(&BackBuffer, PHYSICAL_DISPLAY_XRES - 1 ,PHYSICAL_DISPLAY_YRES - 1,0,PHYSICAL_DISPLAY_YRES - 1);
+      GFX_DrawLine(&BackBuffer,0, PHYSICAL_DISPLAY_YRES - 1,0,0);
+      
+      //Draw a plain string using the 5x7 font.   
+      GFX_DrawString(&BackBuffer,"Rioux Box",6,2, &Font5x7);
+      
+      GFX_DrawHline(&BackBuffer,0,PHYSICAL_DISPLAY_XRES - 1 ,12);
+      
+      //This shows how to do a printf.   Using this allows you to put internal variables, etc on the screen.   
+      //Just lookup documentation on printf on the web to see examples of escape sequences in the control strings   
+      //In this example API_VERSION is a string so we use %s to display it  
+      GFX_printf(&BackBuffer,15,20, &Font3x5,"Ver: %s",API_VERSION);
+      
+      //Move the backbuffer to the actual display
+      GFX_DumpRenderContextToPhysicalScreen(&BackBuffer);
+      
+     
+    //Here is the main super loop
+    
+    //reset and start our control loop Timer
+    ControlLoopTimer.reset();
+    ControlLoopTimer.start();
+    
+    while(1)
+     {
+          //Call this often if you want the USB interface/Terminal
+          ProcessTerminal();
+      
+            /*
+            
+            //control loop example
+            //We will do something ever 250mS.
+            //Use a timer and an if statement we won't hold the microprocessor from do other things in the main super loop!
+            if(ControlLoopTimer.read_ms >= 250)
+            {
+                ControlLoopTimer.reset();    
+                
+                //if 250mSec has elapsed then do our control loop
+                
+                CurrentTemperature = ReadThermocouple(0);
+                
+                if(CurrentTemperature < 15.5)
+                {
+                    EnableHeater(0);
+                }
+                else
+                {
+                   DisableHeater(0);
+                }
+                
+                FlushDigitalIO(); //Remeber, the digital outs are queued up until this is called!
+            }
+            */
+     }
+
+}