Just tested some things myself and found out that the comparison won't work. I guess sugar cane has different ID's when planted vs. harvested. In this case, instead of using turtle.compare(), you can instead use turtle.detect() which should work.
For defining the variable you'd do just
reed = 1
That way it would be global (note that variables are automatically defined as global when you don't specify otherwise in LUA), and the value would be available to any function.
As far as the check function goes, first verify that the slot with...
If you don't plan on changing where you place the reed (i.e. slot 1), you can just do turtle.select(1) instead of defining the reed variable.Also, I just noticed you defined the variable as local. If you wish to use it inside the function you can either:
Define it without the "local" (which...
You're defining reed as the amount of items on slot 1 (reed = turtle.getItemCount(1) ), and using that value in the check function ( turtle.select(reed) ). This is probably not what you wanted, and if the result of the item count is either 0 or > 16, it will cause an error.
If I understand...
Prety much everything. Found these on some wiki a few weeks ago:
Cognito, Corpus, Lignum, Victus, Instrumentum, Messis, Vitreus, Machina, Flos, Vestiola, Venenum, Telum, Metallum, Herba, Sonus, Bestia, Fungus, Tutamen