To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 8618
8617  |  8619
Subject: 
Interactive C
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Mon, 25 Feb 2002 16:26:35 GMT
Viewed: 
7116 times
  
(Perhaps this isn't the right place to ask questions about I.C. but it is
related to the handy board so I will continue)
I am trying to write a program that uses the lego sensors and multiplies
them by constants that are floats. The expansion board returns integers for
the lego sensors so I have a problem there as multiplying floats and ints
isn't permitted by I.C. as far as I can make out. (the program returns an
error saying that <float> * <int> isnt permitted)
Also when I calculate these values I want to use them to determine how long
to leave motors on. I am turning the motors on full, leaving them on using
the mseconds() function and then turning the motors off - again using the
mseconds() function in order to create an exact force on my model. This
function requires long ints so I must convert my answers from above which
are floats into long ints. Again my problem is that as far as I can see
there is no way of converting between these different variables.
Any ideas from anyone?
Thanks,Brendan



Message has 1 Reply:
  Re: Interactive C
 
You have to coerce the int to a float, e.g: int i= 7; float j= 3.; float result; result = j * (float)i; The above should work. Please let me know if not. Fred (...) (23 years ago, 25-Feb-02, to lugnet.robotics.handyboard)

Message is in Reply To:
  Re: Sensor Connector
 
(...) Thanks, I thought there might be a special connector but I see now that its a standard enough connector. Another question: How can I get the handy board to read from the lego rotation sensor and the lego light sensor? I can get the touch (...) (23 years ago, 7-Feb-02, to lugnet.robotics.handyboard)

10 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR