This message was posted on behalf of Intel Corporation2 of 2 people found this helpful
It should be possible to read the temperature for the Edison cores, and you’re on the right track actually. However, I would suggest to use system calls. So for example from C, you could use the following:
If I’m not mistaken you’ll get temperature values from thermal_zone1, thermal_zone3 and thermal_zone4. For zone0 and zone2 the cat command will throw a read error.
This message was posted on behalf of Intel Corporation
It is possible to do it. However, as you already noticed, it is not possible to do it just by setting a variable and getting the value after reading it. This is because you’re reading from outside your code (even if you’re making a system call from your C program). One way to do it would be to make a system call to read the value and then to write the read value to a new/existing file (all of this using system calls), after that, using C file operations you’ll just need to read the value from the file where you wrote it previously. I hope this all makes sense, please let us know if there's something you don't understand.
Thanks Pablo, I finally got it. I used the open call to open the file I needed to read, the read call to read the contents of the file, and then the write call to write it to a new file in a location that I could retrieve it from.
int read1 = open("file_location", O_RDONLY); //FILE THAT I WANTED TO READ FROM.
int write1 = open("new_file", O_TRUNC | O_WRONLY | O_APPEND | O_CREAT, S_IXUSR); //NEW FILE THAT I WANTED TO CREATE
while((n = read(read1,buf,BUFSIZ) > 0))