Jump to content
43oh

CC3200: External Temperature


Recommended Posts

I found the solution : 

 

#include <SPI.h>
#include <WiFi.h>
#include <Wire.h>
#include "Adafruit_TMP006.h"
 
// your network name also called SSID
char ssid[] = "ssid";
// your network password
char password[] = "password";
 
// Get Temp()
Adafruit_TMP006 tmp006(0x41);
  
void setup() {  
  Serial.begin(115200);
  // attempt to connect to Wifi network:
  Serial.print("Attempting to connect to Network named: ");
  // print the network name (SSID);
  Serial.println(ssid); 
  // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
  WiFi.begin(ssid, password);
  while ( WiFi.status() != WL_CONNECTED) {
    // print dots while we wait to connect
    Serial.print(".");
    delay(300);
  }
  
  Serial.println("\nYou're connected to the network");
  Serial.println("Waiting for an ip address");
  
  while (WiFi.localIP() == INADDR_NONE) {
    // print dots while we wait for an ip addresss
    Serial.print(".");
    delay(300);
  }
 
  // We are connected and have an IP address.
  Serial.print("\nIP Address obtained: ");
  Serial.println(WiFi.localIP());
 
  // Get Temperature Test
  if (!tmp006.begin()) {
    Serial.println("No sensor found");
    while (1);
  }
 
}
 
void loop() {   
  Serial.println("Temperature: ");
  Serial.println( getTemp() );
  delay(3000);  
}
 
// getTemp() function for CC3200
double getTemp() {
  return (double)tmp006.readObjTempC();
}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...