You are reading a single comment by @user7143 and its replies. Click here to read the full conversation.
  • Gordon,

    Thanks for your help.

    Here is the code to interface espruino to a max31855 chip. The max31855 is connected to a thermocouple to measure high temperature up to 1300C. Feel free to use it to create a new module for Espruino.

    
    //setup SPI port
    SPI1.setup({ miso:B4, sck:B3, baud:1000000 });
    
    function getTemp() {
      //send command to get 32 bit word back from max31855
      var d = SPI1.send("\0\0\0\0",C0); 
    
      //calculate probe temperature
      eTemp = (d.charCodeAt(0)<<6 | d.charCodeAt(1)>>2)*0.25;
    
      //check for fault codes
      if (d.charCodeAt(1) & 1)  {
          fault = (d.charCodeAt(3) & 7);
    
        switch (fault) {
          case 1:
            console.log("No probe detected");
            break;
          case 3:
            console.log("Probe shorted to Ground");
            break;
          case 4:
            console.log("Probe shorted to VCC");
            break;
          default:
            break;
    
    
      }
      }
    
      
      
      else {
      //Print temperature
    
      console.log("EGT = "+eTemp + " C");
      }
    }
      setInterval(getTemp, 250);
    
    
About

Avatar for user7143 @user7143 started