Main Site Documentation

Fez Spider Real time Clock


#1

Hi

I am relatively new to Gadgeteer and C#.

I have a Fez Spider starter kit and absolutely love it.

However I am trying to work out how to reset the onboard RTC.

I have tried:-



Which I found in the forum at  https://www.ghielectronics.com/community/forum/topic?id=11340&page=2#sthash.pYZyWYVe.dpuf

But when I start typing RealTimeClock it does notr appear in the list of avaiable commands

I have all of the following 'using' statements at the top of my code.


```cs
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

Any help would be much appreciated.

Thanks

Paul


#2

using GHI.Premium.Hardware;


#3

Hi Cowboy

Have added

using GHI.Premium.Hardware;

But GHI is undelined in red and whe nI hover over it I get a message saying:-

" TheType or namespace name ‘GHI’ could not be found"

Sorry to be a bit of a numpty but do Ineed to install something into the resources or something?

Appreciate your help

Paul


#4

Did you add GHI.Premium.hardware to the references.


#5

Hi Cowboy,

Thanks for the help.

Found the reference using the browse tab in the ‘add reference’ tool.

Works a treat now

Regards

Paul


#6

Edited: corrected usage of USING directive, not statement. Thanks @ Taylorza ! :wink:

Threads like this are always a good time to point out what a reference is and what a USING directive is.

If you don’t add a reference to a required assembly, you can’t use the functions that exist in it. So you will never be able to leverage a statement like the RTC one above if you don’t include an assembly that provides that function.

If you add a USING directive, you only give VS a way to “short cut” the naming of function calls. So if you add a reference but don’t add a USING statement, you’ll have to fully qualify the call to the function, for example GHI.Premium.Hardware.RealTimeClock.SetTime(). If you have the USING directive, you can just use RealTimeClock.SetTime() because the GHI.Premium.Hardware portion was already listed in the USING directive. You can think of this as a list of “search paths”, so if you put a USING entry in your code, VS will attempt to locate the function you want across those search paths, or you can just type the full path.


#7

You shouldn’t need to use the browsing tab.
If the SDK is installed correctly it must be in the “.NET” tab.

I also have recognized that this sort of questions comes up quite often lately.
May be we should create a beginners guide for people who do not even really know VisualStudio and C#.

I would be in for writing a step by step guide starting from installation to 1st running program + next steps section for non Gadgeteer projects.
This could be used by someone else to add a Gadgeteer guide.


#8

@ Brett - Just because I am pedantic :slight_smile: what you have described is the using directive, the using statement is a completely different thing.


#9

Hi Reinhard

Don’t know how I’ve managed it but since having added the reference for GHI.Premium.Hardware I can now see all of the .net directives in the .Net tab.

Apologies if I’m not getting the terminology correct I am a newby to .net gadgeteer and c#.

Only recieved my Fez Spider starter kit just before Christmas and I have to say that it is great fun and I’m moving on in leaps and bounds with all of the information available on the internet and really appreciate the help that people like yourself provide on the forum.

Have almost completed 1st stage of my 1st project which is to accept an RS232 data stream from an anemometer which provides wind speed and direction data approx every second. I’m using a T35 display to display the current wind speed and direction and also I’m calculating some averages over a range of minutes. The aim is to use it at my sailing club to provide better information about wind speed and direction.

Along the way I’ve played with the RGB LED modules in daisy chain mode and the button module, really good fun.

Stage 2 of my project is to create a web server so that club members can view the data on the internet, also to create a graphical representation on the T35 display and to create a historical log of data.

That should keep me occupied for a while during the long winter evenings!

Once again many thanks for your help (and others who have replied)

Regards

Paul :slight_smile:


#10

Have just realised whats happening when I add a reference.

If I go to the project menu item and click on add a reference I don’t set anything in the .net tab

But…

If I right click on the references in the solution explorer I can see all of the references

Dont know why, but at least I now know how to add a reference if I need it.

Paul


#11

I’m glad your having fun! I just love it. I recently picked up a few XBee modules and I can see a load of fun with them.


#12

For me there is no difference if I choose Add reference from project menu or solution explorer :think: