samedi 18 avril 2015

How to allow simultaneous reading/writing of a file?

I am new in programming C language, but I have to do a project with three micro-controllers, each using a bluetooth device. The micro-controllers have to access a text file on my computer where they update their activity in order to have one of them measuring temperature (Activity1), another controlling a motor (Activity2) and the other waiting (Activity3) or doing something else (Activity4), but not two of them doing the same activity.


I need to program "something" to make this file available to all micro-controllers. For instance, the text file shows:



Line 1- Activity1 //for micro1
Line 2- Activity3 //for micro2
Line 3- Activity2 //for micro3


After some event, micro1 had to change its activity and update the file



Line 1- Activity4 //for micro1
Line 2- Activity3 //for micro2
Line 3- Activity2 //for micro3


Here, micro1 only have the Activity4 as a free choice to change, but it knew that through reading the file.


I need you tell me what is that "something"? Do I need a server?


Aucun commentaire:

Enregistrer un commentaire