set_each_analog_state not defined

2 replies [Last post]
kfrederick
Title: NooBot
Joined: 11/19/2015
Posts:
BotPoints: 5
User offline. Last seen 6 years 33 weeks ago.

Hi there,

New coach to Botball here.

We are trying to use the library function set_each_analog_state(), but the compiler complains that this is not defined.

Here is our code:

  1. // Created on Thu November 19 2015
  2.  
  3. int main()
  4. {
  5. set_each_analog_state(1,0,0,0,0,0,0,0);
  6. return 0;
  7. }

Here is the compiler/linker error:

sensor.c:
sensor.c:7:2: warning: implicit declaration of function 'set_each_analog_state' is invalid in C99 [-Wimplicit-function-declaration]
set_each_analog_state(1,0,0,0,0,0,0,0);
^
1 warning generated.
sensor.c.o, __internal_target___.c.o:
Undefined symbols for architecture x86_64:
"_set_each_analog_state", referenced from:
_main in sensor.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is there a #include that we need? Or some other configuration that we need to do? We have successfully compiled other programs and run them on our Link.

Many thanks,
Kevin

kfrederick
Title: NooBot
Joined: 11/19/2015
Posts:
BotPoints: 5
User offline. Last seen 6 years 33 weeks ago.

Hey! Never saw a response, but it seems that the set_each_analog_state() function is no longer used. There is a function called analog_et(int) that get the value from the ET sensor directly, which is what I was looking for. For example, here is a simple program that will repeatedly print the value of the ET sensor located on port 0:

  1. int main()
  2. {
  3. int distance;
  4. while(1) {
  5. distance = analog_et(0);
  6. printf("ET: %d\n", distance);
  7. }
  8. return 0;
  9. }

puisi34
Title: NooBot
Joined: 11/30/2016
Posts:
BotPoints: 6
User offline. Last seen 5 years 42 weeks ago.