# Touchscreen.h

**URL:** https://forums.sifive.com/t/touchscreen-h/1566
**Category:** HiFive1 Rev B
**Created:** [September 3, 2018, 8:07am UTC](https://forums.sifive.com/t/touchscreen-h/1566 "2018-09-03T08:07:42Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 8:07am UTC](https://forums.sifive.com/t/touchscreen-h/1566/1 "2018-09-03T08:07:42Z")

</div>

I am working on TFT touch display,it shows compilation error in arduino ide for Hifive1,tells like no library found “Touchscreen.h”. Where can i get Touchscreen.h for sifive? in any repo?  
please kindly help me.

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 3, 2018, 9:00am UTC](https://forums.sifive.com/t/touchscreen-h/1566/2 "2018-09-03T09:00:03Z")

</div>

I get the same error trying to compile a sketch for Arduino Uno if I #include “Touchscreen.h” so it seems it’s not a standard library. Where did you read about it?

Many Arduino libraries will “just work” if they are written in C, without any AVR assembly language, and if they only use interfaces available on the HiFive1.

The one at [https://github.com/Seeed-Studio/Touch\_Screen\_Driver](https://github.com/Seeed-Studio/Touch_Screen_Driver) for example uses analogRead(), which the HiFive1 doesn’t support. You could add an ADC via an I2C bus if you want.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 9:17am UTC](https://forums.sifive.com/t/touchscreen-h/1566/3 "2018-09-03T09:17:51Z")

</div>

I read in error message box in arduino ide.  
ok then i will try with ADC.  
does Hifive1 support I2C ?

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 3, 2018, 9:31am UTC](https://forums.sifive.com/t/touchscreen-h/1566/4 "2018-09-03T09:31:21Z")

</div>

But where did you get the idea to type `#include "Touchscreen.h"` in your program? Did you read it on some web site?

On standard AVR Arduinos I2C is supported by the “wire” library, which we don’t supply. However I2C is extremely easy to implement yourself using digitalRead() and digitalWrite() and a couple of pins. You can find an overview of a wide choice of Arduino I2C libraries at

> **[Testato/SoftwareWire](https://github.com/Testato/SoftwareWire/wiki/Arduino-I2C-libraries)**
>
> Creates a software I2C/TWI bus on every pins. Contribute to Testato/SoftwareWire development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 9:37am UTC](https://forums.sifive.com/t/touchscreen-h/1566/5 "2018-09-03T09:37:46Z")

</div>

i downloaded the zip file of adafruit\_ILI9341 from sifive repository and included the library in Arduino ide.Then i went for some examples “breakouttouchpaint” under Adafruit\_ILI9341.  
Tried compilation for HIFIVE1 board ,then i got these following error message.

* * *

/home/maxvy04/Arduino/libraries/Adafruit\_ILI9341/examples/breakouttouchpaint/breakouttouchpaint.ino:21:25: fatal error: TouchScreen.h: No such file or directory  
#include “TouchScreen.h”  
^  
compilation terminated.  
exit status 1  
Error compiling for board HiFive 1.

* * *

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 3, 2018, 10:14am UTC](https://forums.sifive.com/t/touchscreen-h/1566/6 "2018-09-03T10:14:48Z")

</div>

Oh! I didn’t know @mwachs5 had ported that!

You might try the other examples. They don’t look to need Touchscreen.h. I guess Megan didn’t do anything to port that particular example.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 10:26am UTC](https://forums.sifive.com/t/touchscreen-h/1566/7 "2018-09-03T10:26:57Z")

</div>

Yeah, i tried the other example “graphictest” and it has compiled successfully.

but i may need that touch option in future because i am going to give some inputs via touch.  
That is why!

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 3, 2018, 10:31am UTC](https://forums.sifive.com/t/touchscreen-h/1566/8 "2018-09-03T10:31:10Z")

</div>

OK, good.

The thing is, it looks like you’re going to need some external AtoD converter to use that example anyway, as the FE310 doesn’t have any analogue inputs built in.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 10:31am UTC](https://forums.sifive.com/t/touchscreen-h/1566/9 "2018-09-03T10:31:15Z")

</div>

And kindly let me know if you are familiar with Softwareserial

I want to convert digital pins other than 0 and 1 to UART pins for my sensor.  
Library is there for AVR boards but i couldnt find it for Hifive1.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 10:31am UTC](https://forums.sifive.com/t/touchscreen-h/1566/10 "2018-09-03T10:31:55Z")

</div>

Yes,  
Definitely i will try it out  
Thanks a lot

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 3, 2018, 10:54am UTC](https://forums.sifive.com/t/touchscreen-h/1566/11 "2018-09-03T10:54:10Z")

</div>

I’ve heard of it 🙂 I see it uses interrupts. The HiFive1 supports edge and level interrupts on every GPIO pin. I don’t actually know offhand whether attachInterrupt() has been implemented in the Arduino environment, but you can definitely do it from plain C. You can read about that in the E300 Platform Reference Manual. You’ll need assembly language if you write your own interrupt handlers. “ **attribute** ((interrupt))” has recently been added to RISC-V gcc to enable interrupt handlers to be written in pure C but I don’t think the Arduino package has been updated to include that.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 3, 2018, 10:57am UTC](https://forums.sifive.com/t/touchscreen-h/1566/12 "2018-09-03T10:57:27Z")

</div>

okay:+1:  
Thank you.🙂

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 5, 2018, 9:43am UTC](https://forums.sifive.com/t/touchscreen-h/1566/13 "2018-09-05T09:43:49Z")

</div>

![Screenshot from 2018-09-05 15-10-12](https://us1.discourse-cdn.com/flex020/uploads/sifive/original/1X/5a651f1a23408b7c17c5532f79ffe1d18c5a9843.jpg)  
I think they are Sifive people!!  
These people had tested with touch display shield ,if they could tell the library that they used it would be good .I can try it out with my breakout board.

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 5, 2018, 10:08am UTC](https://forums.sifive.com/t/touchscreen-h/1566/14 "2018-09-05T10:08:13Z")

</div>

Interesting. I hadn’t seen that video or those prototype boards before! And those have to be @mwachs5 hands holding that board+shield.

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 5, 2018, 11:23am UTC](https://forums.sifive.com/t/touchscreen-h/1566/15 "2018-09-05T11:23:41Z")

</div>

yes

---

<div class="post-metadata">

### Author: ![mwachs5](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mwachs5/32/13_2.png) [@mwachs5](https://forums.sifive.com/u/mwachs5)
#### Post date: [September 5, 2018, 4:15pm UTC](https://forums.sifive.com/t/touchscreen-h/1566/16 "2018-09-05T16:15:53Z")

</div>

Yes, we have ported the Adafruit touchscreen library to the HiFive1. You can find it on our SiFive github:

> **[sifive/Adafruit\_ILI9341](https://github.com/sifive/Adafruit_ILI9341)**
>
> Library for Adafruit ILI9341 displays. Contribute to sifive/Adafruit\_ILI9341 development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![mwachs5](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/mwachs5/32/13_2.png) [@mwachs5](https://forums.sifive.com/u/mwachs5)
#### Post date: [September 5, 2018, 4:16pm UTC](https://forums.sifive.com/t/touchscreen-h/1566/17 "2018-09-05T16:16:49Z")

</div>

The compile errors you’re getting may be an Arduino version compatability issue. What version of the Arduino IDE are you using?

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 5, 2018, 5:14pm UTC](https://forums.sifive.com/t/touchscreen-h/1566/18 "2018-09-05T17:14:32Z")

</div>

1.8.5

---

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [September 5, 2018, 5:19pm UTC](https://forums.sifive.com/t/touchscreen-h/1566/19 "2018-09-05T17:19:45Z")

</div>

This version was mentioned in the hifive1 getting started [guide.So](http://guide.So) i followed the link.

---

<div class="post-metadata">

### Author: ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)
#### Post date: [September 6, 2018, 3:01am UTC](https://forums.sifive.com/t/touchscreen-h/1566/20 "2018-09-06T03:01:54Z")

</div>

The issue is that…

> <https://github.com/sifive/Adafruit_ILI9341/blob/freedom_e300/examples/breakouttouchpaint/breakouttouchpaint.ino>

… does a #include of TouchScreen.h which is not included in that repo, and not in either our or the standard Arduino IDE download.

And then the YP and XM defines in breakouttouchpaint.ino “must be an analog pin”, which the HiFive1 does not have any of.

[Next page](https://forums.sifive.com/t/touchscreen-h/1566.md?page=2)
