Skip to content
Kellen Cheng edited this page Feb 12, 2018 · 18 revisions

Arduino Method Descriptions

Calibrate

needs review

Calibrates the emitter/sensor channels, tries to get the freshly inoculated media as close to a sensor output of 0.3V (ADC value 1600) as possible to allow for maximum capacity for growth sensing, as well as a little buffer for the media getting clearer before it occludes

debug_loop

needs review

Description

Constantly outputs the ADC values for a single tube box selected by the 4 Channel switch, to the LCD display. Does NOT record any of the information anywhere!

adc_read

Description

Returns the ADC value of a single tube channel, sums up all adc readings and finds the average of the readings by dividing by the number of readings taken.

Parameters


Param Type Description
channel int Number of channels there are to read

Returns


Type Description
double Returns average adc values, rounded up

write_data_to_SD_card

needs review

Description

Writes the current time and channel output values from the data structure to the current file on the SD Card

sendpacket

needs review

Description

Sends the data packet to the server via the Ethernet Shield

Parameters


Param Type Description
on boolean Checks if the Ethernet shield is on or off

shaker_stop

needs review, uses time to see when to raise platforms might not be related, but best to check

Description

Method that stops the shaker, turns off the relay, and waits for the table to come to a stop.

shaker_start

needs review

Description

Turns on the relay, which in turn powers on the shaker table, which holds onto the last set value, and spins up to that rpm. This function doesn't wait for the shaker table to get up to speed

raise_platform

needs review, this has variables that use time so we might want to look into it.
Though i don't think it will be related.
Also the while loop within this code is empty. Might want to look at if it's supposed to be intentional

Description

Raises the lifting platform, and waits until it is completely lifted

lower_platform

needs review, has variable that uses time might not be relevant, but good to check Problem in code, where it pauses forever, says in notes it would be better for this to be programmed to gracefully recover from

Description

Lowers the platform and waits for the platform to come to a complete stop.

printdelayinfo(unsigned long scan_time)

Description

Prints to the Serial console the timing information currently set (and passed)

Parameter


Param Type Description
scan_time unsigned long scan time to print to the LCD

channel_select

Description

Sets the multiplexer channel select pins to the channel passed

Parameter


Param Type Description
channel Int sets the selected channel for the multiplexer

LcdPrint

Description

Prints a passed message to the lines on the lcd, each line are trimmed to 20 characters, or filled with white space to make up 20 characters.

Parameter


Param Type Description
first_line String first line the first message will be displayed on
second_line String second line the second message will be displayed on
third_line String third line the third message will be displayed on
fourth_line String fourth line the fourth message will be displayed on

lcd3LinePrint

Description

Prints the passed messages to the first three lines on the LCD, using the fourth line as a place for PAUSE and RAM information

Parameters


Parameter Type Description
first_line String First line to print on the LCD
second_line String Second line to print on the LCD
third_line String Third line to print on the LCD

lcdDebugPrint

Description

Needs review

Takes in the row and column and the data associated with it and prints it to the lcd screen.


Param Type Description
Column Int The column number
Row Int The row number
Data Int The data value at the selected column and row value

trimStringEndToTwentyChars

Description

checks to see if the message is greater then 20 characters, changes it to 20 characters, and returns the message, if it's less, returns the message with nothing done.

Parameters


Param Type Description
msg String takes in a string that will be returned with 20 less characters

Return


Type Description
String returns the message, either the original or trimmed to 20 characters

fillStringEndWithVariableWhitespace

Description

Returns a String of desired length containing a desired string appended with spaces until a desired length has been reached

Parameters


Param Type Description
msg String String to append whitespace to
desired_length int length of string to output with whitespace

Returns


Type Description
String A String of length determined by the desired_length parameter

initalizeSDCardFile

needs review

Description

Determines if SD Card access is possible, and if so sets the system to do so and figures out which file to write to on the SD Card.

Filenames conform to the following formatting:

1M30D.csv - this file would be the first file written to the card on January 30th
1M30D1.csv - this file would be the second file written to the card on January 30th
1M30D99.csv - this file would be the last acceptable file written to the card on January 30th since filenames must conform to 8.3 format
12M9D7.csv - this file would be the eighth file written to the card on December 9th

set_LCD_Color

Description

Sets the background colors of the LCD to Red, Green or Blue values passed in the array. In the order of RGB.

Parameters


Param Type Description
colors[] Int Takes in an integer to set the background as red, green or blue

void pause_button_interrupt_service_routine

Description

When the pause button interrupt is triggered, this service routine sets the pause flag

checkPauseButton

needs Review (I believe they said this was not working??)

Description

If the pause flag is set, pauses the system if it was unpaused, and unpauses the system if it was paused

System_pause

Needs review, has a part of the code that the original programmer wasn't sure it was for

Description

Pauses the system, halting it from any further activity until the pause button is pressed again.

set_critical_section_mode

Description

Disables pause button and interval knob so that nothing can disturb the delicate tasks performed while the system is in this mode. Also sets "critical-section" backlight color on LCD

resume_Normal_Mode

needs review

Description

Re-enables pause button and interval knob, also restores normal mode backlight color

checkFourChannelFlag

needs review

Description

Checks 4-channel rotary knobs and sets the data interval according to the set knob.

checkEightChannelFlag

Description

Checks the 8-ch rotary knob and sets the tube box to take continuous readings from in debug mode to that which is set by the knob, if the eight_channel_flag is set

eight_channel_isr

Description

Sets the eight_channel_flag upon 8-ch switch interrupt interception

four_channel_isr

needs review

Description

Sets the four_channel_flag upon 4-ch switch interrupt interception