Skip to content

Commit

Permalink
Temperature sensor is working.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlkalberer committed Oct 2, 2015
1 parent 6cdd6e6 commit 13c6c3d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
9 changes: 4 additions & 5 deletions Source/KegServer/KegServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <OneWire.h>
#include "Temperature.h"

#define SSID "casanova"
#define PASSWORD "bitchhunter"
#define SSID "da_shiz"
#define PASSWORD "longasspassword"
#define AUTH WIFLY_AUTH_WPA2_PSK

//#define LOGGING 1
Expand Down Expand Up @@ -54,7 +54,7 @@ const int kNetworkDelay = 1000;

WiFly wifly(WIFLY_PIN_1, WIFLY_PIN_2);
NFC nfc;
RestClient r(wifly, "192.168.1.144");
RestClient r(wifly, "192.168.1.113");

byte state, waitCount;
volatile int flowCount = 0;
Expand All @@ -63,7 +63,6 @@ unsigned long time, totalPulses;
void setup()
{
Serial.begin(9600);

// initialize serial communications at 9600 bps:

Memory();
Expand Down Expand Up @@ -205,4 +204,4 @@ void ReadTemperature()
void flowCounter()
{
flowCount++;
}
}
6 changes: 3 additions & 3 deletions Source/KegServer/KegServer.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -18,13 +18,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
6 changes: 6 additions & 0 deletions Source/KegServer/KegServer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<ClCompile Include="NFC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Temperature.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="b64.h">
Expand Down Expand Up @@ -74,6 +77,9 @@
<ClInclude Include="NFC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Temperature.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="KegServer.ino" />
Expand Down
24 changes: 14 additions & 10 deletions Source/KegServer/NFC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#define BLOCK_SIZE 16

NFC::NFC() : nfc(SCK, MISO, MOSI, SS) , linkLayer(&nfc), snep(&linkLayer)
NFC::NFC() : nfc(SS) , linkLayer(&nfc), snep(&linkLayer)
{
this->state = ReadPhone;
this->state = ReadCard;
}

void NFC::Setup()
Expand Down Expand Up @@ -34,7 +34,7 @@ uint8_t* NFC::Read()

if (this->state == ReadCard)
{
this->state = ReadPhone;
//this->state = ReadPhone;

uint8_t success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
Expand All @@ -47,7 +47,7 @@ uint8_t* NFC::Read()

if (success) {
// Display some basic information about the card
DBGL("Found an ISO14443A card");
Serial.println("Found an ISO14443A card");
DBG(" UID Length: ");DBG(uidLength);DBGL(" bytes");
DBG(" UID Value: ");
DBGL("");
Expand Down Expand Up @@ -147,14 +147,17 @@ uint8_t* NFC::Read()
else if (uidLength == 7)
{
// We probably have a Mifare Ultralight card ...
DBGL("Seems to be a Mifare Ultralight tag (7 byte UID)");
Serial.println("Seems to be a Mifare Ultralight tag (7 byte UID)");

// Try to read the first general-purpose user page (#4)
DBGL("Reading page 4");
for(int i = 0; i < 5; i++)
{
uint8_t data[32];
success = nfc.mifareultralight_ReadPage (4, data);
success = nfc.mifareultralight_ReadPage (i, data);
if (success)
{
Serial.println((char*)data);
// Data seems to have been read ... spit it out
this->rxNDEFMessagePtr = NULL;

Expand All @@ -164,10 +167,11 @@ uint8_t* NFC::Read()
else
{
DBGL("Ooops ... unable to read the requested page!?");
}
}
}
}
}
}
}/*
else if (this->state == ReadPhone)
{
this->state = ReadCard;
Expand Down Expand Up @@ -228,7 +232,7 @@ uint8_t* NFC::Read()
DBGL("Error...");
this->rxNDEFMessagePtr = NULL;
}
}
}*/

return rxNDEFMessagePtr;
}
}

0 comments on commit 13c6c3d

Please sign in to comment.