Hiba Kharma
Published © GPL3+

Industrial temperature indicator

This project contains a thermocouple temperature sensor (H09R0x) with three Hexabitz RGB modules (H01R0x)

IntermediateFull instructions provided2 hours119
Industrial temperature indicator

Things used in this project

Story

Read more

Custom parts and enclosures

temperature_TNjMDbo40y.rar

Code

industrial temperature indicator code

C/C++
/**
  ******************************************************************************
  * File Name          : main.c
  * Description        : Main program body
  ******************************************************************************
  *
  * COPYRIGHT(c) 2015 STMicroelectronics
  *
  * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *   1. Redistributions of source code must retain the above copyright notice,
  *      this list of conditions and the following disclaimer.
  *   2. Redistributions in binary form must reproduce the above copyright notice,
  *      this list of conditions and the following disclaimer in the documentation
  *      and/or other materials provided with the distribution.
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written
  *      permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ******************************************************************************
  */
	
/*
		MODIFIED by Hexabitz for BitzOS (BOS) V0.2.2 - Copyright (C) 2017-2020 Hexabitz
    All rights reserved
*/

/* Includes ------------------------------------------------------------------*/
#include "BOS.h"

/* Private variables ---------------------------------------------------------*/
float  tempc;

/* Main function ------------------------------------------------------------*/

int main(void){


	Module_Init();		//Initialize Module &  BitzOS

	//Don't place your code here.
	for(;;){}
}

/*-----------------------------------------------------------*/

/* User Task */
void UserTask(void *argument){

	// put your code here, to run repeatedly.
	while(1){
	 SampleC(&tempc);
  //***************************************
			 if(tempc < 10.0f)
				 {
				    messageParams[0]=0;
				    messageParams[1]=BLUE;
				    messageParams[2]=75;
				    SendMessageToModule(2, CODE_H01R0_COLOR, 3);

				    SendMessageToModule(3,CODE_H01R0_OFF,0);
				    SendMessageToModule(4,CODE_H01R0_OFF,0);

		         }
 //****************************************
		   if((tempc > 10.0f) && (tempc <20.0f))
			  {
			    messageParams[0]=0;
			    messageParams[1]=BLUE;
			    messageParams[2]=75;
			    SendMessageToModule(2, CODE_H01R0_COLOR, 3);
			    //------------------
			    messageParams[0]=0;
			    messageParams[1]=BLUE;
			    messageParams[2]=75;
			    SendMessageToModule(3, CODE_H01R0_COLOR, 3);
			    //------------------
			    SendMessageToModule(4, CODE_H01R0_OFF,0);
	         }
//*****************************************
		  if((tempc >= 20.0f) && (tempc <30.0f))
		     {
				 messageParams[0]=0;
				 messageParams[1]=BLUE;
				 messageParams[2]=75;
				 SendMessageToModule(2, CODE_H01R0_COLOR, 3);
//------------------
				  messageParams[0]=0;
				  messageParams[1]=BLUE;
				  messageParams[2]=75;
				  SendMessageToModule(3, CODE_H01R0_COLOR, 3);
//------------------
				  messageParams[0]=0;
				  messageParams[1]=BLUE;
				  messageParams[2]=75;
				  SendMessageToModule(4, CODE_H01R0_COLOR, 3);

			 }
 //*****************************************
			  if((tempc >= 30.0f) && (tempc <40.0f))
				 {
				  messageParams[0]=0;
				  messageParams[1]=YELLOW;
			      messageParams[2]=75;
				  SendMessageToModule(2, CODE_H01R0_COLOR, 3);
			      SendMessageToModule(3,CODE_H01R0_OFF,0);
				  SendMessageToModule(4,CODE_H01R0_OFF,0);
			     }
 //*****************************************
             if((tempc >= 40.0f) && (tempc <50.0f))
				 {
				  messageParams[0]=0;
				  messageParams[1]=YELLOW;
				  messageParams[2]=75;
				  SendMessageToModule(2, CODE_H01R0_COLOR, 3);
 //------------------
				 messageParams[0]=0;
				 messageParams[1]=YELLOW;
				 messageParams[2]=75;
				 SendMessageToModule(3, CODE_H01R0_COLOR, 3);
//------------------
				 SendMessageToModule(4, CODE_H01R0_OFF,0);
										         }
//*****************************************
			if((tempc >=50.0f) && (tempc <55.0f))
			   {
				  messageParams[0]=0;
				  messageParams[1]=YELLOW;
				  messageParams[2]=75;
				  SendMessageToModule(2, CODE_H01R0_COLOR, 3);
//------------------
				 messageParams[0]=0;
			     messageParams[1]=YELLOW;
				 messageParams[2]=75;
				 SendMessageToModule(3, CODE_H01R0_COLOR, 3);
//------------------
				 messageParams[0]=0;
				 messageParams[1]=YELLOW;
			     messageParams[2]=75;
				SendMessageToModule(4, CODE_H01R0_COLOR, 3);

			 }
			 //*****************************************
		   if((tempc >= 55.0f) && (tempc <60.0f))
			 {
			   messageParams[0]=0;
			   messageParams[1]=RED;
			   messageParams[2]=75;
			   SendMessageToModule(2, CODE_H01R0_COLOR, 3);
			   SendMessageToModule(3,CODE_H01R0_OFF,0);
		    	SendMessageToModule(4,CODE_H01R0_OFF,0);
			 }
 //*****************************************
		 if((tempc >= 60.0f) && (tempc <65.0f))
			 {
			  messageParams[0]=0;
			  messageParams[1]=RED;
			  messageParams[2]=75;
			  SendMessageToModule(2, CODE_H01R0_COLOR, 3);
			 //------------------
			 messageParams[0]=0;
			 messageParams[1]=RED;
			 messageParams[2]=75;
			 SendMessageToModule(3, CODE_H01R0_COLOR, 3);
			//------------------
			SendMessageToModule(4,CODE_H01R0_OFF,0);
			}
 //*****************************************
		 if((tempc >= 65.0f) )
		   {
		     messageParams[0]=0;
		     messageParams[1]=RED;
		     messageParams[2]=75;
		     SendMessageToModule(2, CODE_H01R0_COLOR, 3);
		    //------------------
		    messageParams[0]=0;
		    messageParams[1]=RED;
		    messageParams[2]=75;
		    SendMessageToModule(3, CODE_H01R0_COLOR, 3);
		    //------------------
		     messageParams[0]=0;
		     messageParams[1]=RED;
		     messageParams[2]=75;
		     SendMessageToModule(4, CODE_H01R0_COLOR, 3);
		 }}}


/*-----------------------------------------------------------*/
  /* Start scheduler */
  osKernelStart();

Credits

Hiba Kharma
2 projects • 5 followers

Comments